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 5
5
6
6
import { TextDocument } from 'vscode'
7
7
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
+
8
52
export function extractLanguageNameFromFile ( file : TextDocument ) : string | undefined {
9
53
const languageId = file . languageId
10
54
11
55
if ( languageId === undefined ) {
12
56
return undefined
13
57
}
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 ) ) {
59
59
return languageId
60
60
}
61
61
switch ( languageId ) {
@@ -117,54 +117,7 @@ export function extractLanguageNameFromFile(file: TextDocument): string | undefi
117
117
export function extractAdditionalLanguageMatchPoliciesFromFile ( file : TextDocument ) : Set < string > {
118
118
const languageId = file . languageId
119
119
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 ) ) {
168
121
return new Set < string > ( )
169
122
}
170
123
switch ( languageId ) {
You can’t perform that action at this time.
0 commit comments