@@ -34,6 +34,22 @@ lazy_static! {
3434 vec![ LoadPath :: Grammar ( "queries/builtins" . into( ) ) ] ;
3535}
3636
37+ /// Data type that holds all information to recognize and analyze files for a language
38+ pub struct LanguageConfiguration {
39+ pub language : Language ,
40+ pub scope : Option < String > ,
41+ pub content_regex : Option < Regex > ,
42+ pub file_types : Vec < String > ,
43+ pub sgl : StackGraphLanguage ,
44+ pub builtins : StackGraph ,
45+ }
46+
47+ impl LanguageConfiguration {
48+ pub fn matches_file ( & self , path : & Path , content : Option < & str > ) -> bool {
49+ matches_file ( & self . file_types , & self . content_regex , path, content) . is_some ( )
50+ }
51+ }
52+
3753/// A load path specifies a file to load from, either as a regular path or relative to the grammar location.
3854#[ derive( Clone , Debug ) ]
3955pub enum LoadPath {
@@ -238,21 +254,6 @@ impl From<crate::LoadError> for LoadError {
238254// ------------------------------------------------------------------------------------------------
239255// provided languages loader
240256
241- pub struct LanguageConfiguration {
242- pub language : Language ,
243- pub scope : Option < String > ,
244- pub content_regex : Option < Regex > ,
245- pub file_types : Vec < String > ,
246- pub sgl : StackGraphLanguage ,
247- pub builtins : StackGraph ,
248- }
249-
250- impl LanguageConfiguration {
251- pub fn matches_file ( & self , path : & Path , content : Option < & str > ) -> bool {
252- matches_file ( & self . file_types , & self . content_regex , path, content) . is_some ( )
253- }
254- }
255-
256257struct LanguageConfigurationsLoader {
257258 configurations : Vec < LanguageConfiguration > ,
258259}
0 commit comments