@@ -111,7 +111,7 @@ impl Display for IncludePosition {
111111}
112112
113113pub enum TreeType {
114- Fragment , Vertex , Geometry
114+ Fragment , Vertex , Geometry , Compute
115115}
116116
117117impl MinecraftShaderLanguageServer {
@@ -290,15 +290,24 @@ impl MinecraftShaderLanguageServer {
290290 merge_views:: generate_merge_list ( & tree, & all_sources, & graph)
291291 } ;
292292
293- let root_path = self . graph . borrow ( ) . get_node ( root) . clone ( ) ;
294- let tree_type = if root_path. extension ( ) . unwrap ( ) == "fsh" {
293+ let root_path = self . graph . borrow ( ) . get_node ( root) ;
294+ let ext = match root_path. extension ( ) {
295+ Some ( ext) => ext,
296+ None => {
297+ back_fill ( & all_sources, & mut diagnostics) ;
298+ return Ok ( diagnostics)
299+ } ,
300+ } ;
301+ let tree_type = if ext == "fsh" {
295302 TreeType :: Fragment
296- } else if root_path . extension ( ) . unwrap ( ) == "vsh" {
303+ } else if ext == "vsh" {
297304 TreeType :: Vertex
298- } else if root_path . extension ( ) . unwrap ( ) == "gsh" {
305+ } else if ext == "gsh" {
299306 TreeType :: Geometry
307+ } else if ext == "csh" {
308+ TreeType :: Compute
300309 } else {
301- eprintln ! ( "got a non fsh|vsh ({:?}) as a file root ancestor: {:?}" , root_path . extension ( ) . unwrap ( ) , root_path) ;
310+ eprintln ! ( "got a non fsh|vsh|gsh|csh ({:?}) as a file root ancestor: {:?}" , ext , root_path) ;
302311 back_fill ( & all_sources, & mut diagnostics) ;
303312 return Ok ( diagnostics)
304313 } ;
@@ -325,14 +334,20 @@ impl MinecraftShaderLanguageServer {
325334 } ;
326335
327336 let root_path = self . graph . borrow ( ) . get_node ( * root) . clone ( ) ;
328- let tree_type = if root_path. extension ( ) . unwrap ( ) == "fsh" {
337+ let ext = match root_path. extension ( ) {
338+ Some ( ext) => ext,
339+ None => continue
340+ } ;
341+ let tree_type = if ext == "fsh" {
329342 TreeType :: Fragment
330- } else if root_path . extension ( ) . unwrap ( ) == "vsh" {
343+ } else if ext == "vsh" {
331344 TreeType :: Vertex
332- } else if root_path . extension ( ) . unwrap ( ) == "gsh" {
345+ } else if ext == "gsh" {
333346 TreeType :: Geometry
347+ } else if ext == "csh" {
348+ TreeType :: Compute
334349 } else {
335- eprintln ! ( "got a non fsh|vsh ({:?}) as a file root ancestor: {:?}" , root_path . extension ( ) . unwrap ( ) , root_path) ;
350+ eprintln ! ( "got a non fsh|vsh|gsh|csh ({:?}) as a file root ancestor: {:?}" , ext , root_path) ;
336351 continue ;
337352 } ;
338353
0 commit comments