File tree Expand file tree Collapse file tree 1 file changed +46
-93
lines changed
packages/core/src/codewhispererChat/editor/context/file Expand file tree Collapse file tree 1 file changed +46
-93
lines changed Original file line number Diff line number Diff line change 55
66import { TextDocument } from 'vscode'
77
8+ const defaultLanguages = [
9+ 'yaml' ,
10+ 'xsl' ,
11+ 'xml' ,
12+ 'vue' ,
13+ 'tex' ,
14+ 'typescript' ,
15+ 'swift' ,
16+ 'stylus' ,
17+ 'sql' ,
18+ 'slim' ,
19+ 'shaderlab' ,
20+ 'sass' ,
21+ 'rust' ,
22+ 'ruby' ,
23+ 'r' ,
24+ 'python' ,
25+ 'pug' ,
26+ 'powershell' ,
27+ 'php' ,
28+ 'perl' ,
29+ 'markdown' ,
30+ 'makefile' ,
31+ 'lua' ,
32+ 'less' ,
33+ 'latex' ,
34+ 'json' ,
35+ 'javascript' ,
36+ 'java' ,
37+ 'ini' ,
38+ 'html' ,
39+ 'haml' ,
40+ 'handlebars' ,
41+ 'groovy' ,
42+ 'go' ,
43+ 'diff' ,
44+ 'css' ,
45+ 'c' ,
46+ 'coffeescript' ,
47+ 'clojure' ,
48+ 'bibtex' ,
49+ 'abap' ,
50+ ]
51+
852export function extractLanguageNameFromFile ( file : TextDocument ) : string | undefined {
953 const languageId = file . languageId
1054
1155 if ( languageId === undefined ) {
1256 return undefined
1357 }
14- if (
15- [
16- 'yaml' ,
17- 'xsl' ,
18- 'xml' ,
19- 'vue' ,
20- 'tex' ,
21- 'typescript' ,
22- 'swift' ,
23- 'stylus' ,
24- 'sql' ,
25- 'slim' ,
26- 'shaderlab' ,
27- 'sass' ,
28- 'rust' ,
29- 'ruby' ,
30- 'r' ,
31- 'python' ,
32- 'pug' ,
33- 'powershell' ,
34- 'php' ,
35- 'perl' ,
36- 'markdown' ,
37- 'makefile' ,
38- 'lua' ,
39- 'less' ,
40- 'latex' ,
41- 'json' ,
42- 'javascript' ,
43- 'java' ,
44- 'ini' ,
45- 'html' ,
46- 'haml' ,
47- 'handlebars' ,
48- 'groovy' ,
49- 'go' ,
50- 'diff' ,
51- 'css' ,
52- 'c' ,
53- 'coffeescript' ,
54- 'clojure' ,
55- 'bibtex' ,
56- 'abap' ,
57- ] . includes ( languageId )
58- ) {
58+ if ( defaultLanguages . includes ( languageId ) ) {
5959 return languageId
6060 }
6161 switch ( languageId ) {
@@ -117,54 +117,7 @@ export function extractLanguageNameFromFile(file: TextDocument): string | undefi
117117export function extractAdditionalLanguageMatchPoliciesFromFile ( file : TextDocument ) : Set < string > {
118118 const languageId = file . languageId
119119
120- if ( languageId === undefined ) {
121- return new Set < string > ( )
122- }
123- if (
124- [
125- 'yaml' ,
126- 'xsl' ,
127- 'xml' ,
128- 'vue' ,
129- 'tex' ,
130- 'typescript' ,
131- 'swift' ,
132- 'stylus' ,
133- 'sql' ,
134- 'slim' ,
135- 'shaderlab' ,
136- 'sass' ,
137- 'rust' ,
138- 'ruby' ,
139- 'r' ,
140- 'python' ,
141- 'pug' ,
142- 'powershell' ,
143- 'php' ,
144- 'perl' ,
145- 'markdown' ,
146- 'makefile' ,
147- 'lua' ,
148- 'less' ,
149- 'latex' ,
150- 'json' ,
151- 'javascript' ,
152- 'java' ,
153- 'ini' ,
154- 'html' ,
155- 'haml' ,
156- 'handlebars' ,
157- 'groovy' ,
158- 'go' ,
159- 'diff' ,
160- 'css' ,
161- 'c' ,
162- 'coffeescript' ,
163- 'clojure' ,
164- 'bibtex' ,
165- 'abap' ,
166- ] . includes ( languageId )
167- ) {
120+ if ( languageId === undefined || defaultLanguages . includes ( languageId ) ) {
168121 return new Set < string > ( )
169122 }
170123 switch ( languageId ) {
You can’t perform that action at this time.
0 commit comments