Skip to content

Commit 8d83472

Browse files
committed
add "language" template variable for autocomplete
1 parent 27772b9 commit 8d83472

File tree

6 files changed

+25
-4
lines changed

6 files changed

+25
-4
lines changed

core/autocomplete/completionProvider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ export class CompletionProvider {
581581
suffix,
582582
filename,
583583
reponame,
584+
language: lang.name,
584585
});
585586
} else {
586587
// Let the template function format snippets

core/autocomplete/languages.ts

+24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { LineFilter } from "./lineStream";
22

33
export interface AutocompleteLanguageInfo {
4+
name: string;
45
topLevelKeywords: string[];
56
singleLineComment: string;
67
endOfLine: string[];
@@ -14,13 +15,15 @@ export interface AutocompleteLanguageInfo {
1415

1516
// TypeScript
1617
export const Typescript = {
18+
name: "TypeScript",
1719
topLevelKeywords: ["function", "class", "module", "export", "import"],
1820
singleLineComment: "//",
1921
endOfLine: [";"],
2022
};
2123

2224
// Python
2325
export const Python = {
26+
name: "Python",
2427
// """"#" is for .ipynb files, where we add '"""' surrounding markdown blocks.
2528
// This stops the model from trying to complete the start of a new markdown block
2629
topLevelKeywords: ["def", "class", '"""#'],
@@ -30,55 +33,63 @@ export const Python = {
3033

3134
// Java
3235
export const Java = {
36+
name: "Java",
3337
topLevelKeywords: ["class", "function"],
3438
singleLineComment: "//",
3539
endOfLine: [";"],
3640
};
3741

3842
// C++
3943
export const Cpp = {
44+
name: "C++",
4045
topLevelKeywords: ["class", "namespace", "template"],
4146
singleLineComment: "//",
4247
endOfLine: [";"],
4348
};
4449

4550
// C#
4651
export const CSharp = {
52+
name: "C#",
4753
topLevelKeywords: ["class", "namespace", "void"],
4854
singleLineComment: "//",
4955
endOfLine: [";"],
5056
};
5157

5258
// C
5359
export const C = {
60+
name: "C",
5461
topLevelKeywords: ["if", "else", "while", "for", "switch", "case"],
5562
singleLineComment: "//",
5663
endOfLine: [";"],
5764
};
5865

5966
// Scala
6067
export const Scala = {
68+
name: "Scala",
6169
topLevelKeywords: ["def", "val", "var", "class", "object", "trait"],
6270
singleLineComment: "//",
6371
endOfLine: [";"],
6472
};
6573

6674
// Go
6775
export const Go = {
76+
name: "Go",
6877
topLevelKeywords: ["func", "package", "import", "type"],
6978
singleLineComment: "//",
7079
endOfLine: [],
7180
};
7281

7382
// Rust
7483
export const Rust = {
84+
name: "Rust",
7585
topLevelKeywords: ["fn", "mod", "pub", "struct", "enum", "trait"],
7686
singleLineComment: "//",
7787
endOfLine: [";"],
7888
};
7989

8090
// Haskell
8191
export const Haskell = {
92+
name: "Haskell",
8293
topLevelKeywords: [
8394
"data",
8495
"type",
@@ -95,48 +106,55 @@ export const Haskell = {
95106

96107
// PHP
97108
export const PHP = {
109+
name: "PHP",
98110
topLevelKeywords: ["function", "class", "namespace", "use"],
99111
singleLineComment: "//",
100112
endOfLine: [";"],
101113
};
102114

103115
// Ruby on Rails
104116
export const RubyOnRails = {
117+
name: "Ruby on Rails",
105118
topLevelKeywords: ["def", "class", "module"],
106119
singleLineComment: "#",
107120
endOfLine: [],
108121
};
109122

110123
// Swift
111124
export const Swift = {
125+
name: "Swift",
112126
topLevelKeywords: ["func", "class", "struct", "import"],
113127
singleLineComment: "//",
114128
endOfLine: [";"],
115129
};
116130

117131
// Kotlin
118132
export const Kotlin = {
133+
name: "Kotlin",
119134
topLevelKeywords: ["fun", "class", "package", "import"],
120135
singleLineComment: "//",
121136
endOfLine: [";"],
122137
};
123138

124139
// Ruby
125140
export const Ruby = {
141+
name: "Ruby",
126142
topLevelKeywords: ["class", "module", "def"],
127143
singleLineComment: "#",
128144
endOfLine: [],
129145
};
130146

131147
// Clojure
132148
export const Clojure = {
149+
name: "Clojure",
133150
topLevelKeywords: ["def", "fn", "let", "do", "if", "defn", "ns", "defmacro"],
134151
singleLineComment: ";",
135152
endOfLine: [],
136153
};
137154

138155
// Julia
139156
export const Julia = {
157+
name: "Julia",
140158
topLevelKeywords: [
141159
"function",
142160
"macro",
@@ -155,6 +173,7 @@ export const Julia = {
155173

156174
// F#
157175
export const FSharp = {
176+
name: "F#",
158177
topLevelKeywords: [
159178
"let",
160179
"type",
@@ -173,6 +192,7 @@ export const FSharp = {
173192

174193
// R
175194
export const R = {
195+
name: "R",
176196
topLevelKeywords: [
177197
"function",
178198
"if",
@@ -189,13 +209,15 @@ export const R = {
189209

190210
// Dart
191211
export const Dart = {
212+
name: "Dart",
192213
topLevelKeywords: ["class", "import", "void", "enum"],
193214
singleLineComment: "//",
194215
endOfLine: [";"],
195216
};
196217

197218
// Solidity
198219
export const Solidity = {
220+
name: "Solidity",
199221
topLevelKeywords: [
200222
"contract",
201223
"event",
@@ -218,6 +240,7 @@ export const Solidity = {
218240

219241
// YAML
220242
export const YAML: AutocompleteLanguageInfo = {
243+
name: "YAML",
221244
topLevelKeywords: [],
222245
singleLineComment: "#",
223246
endOfLine: [],
@@ -258,6 +281,7 @@ export const YAML: AutocompleteLanguageInfo = {
258281
};
259282

260283
export const Markdown: AutocompleteLanguageInfo = {
284+
name: "Markdown",
261285
topLevelKeywords: [],
262286
singleLineComment: "",
263287
endOfLine: [],

eval/repos/amplified-dev

-1
This file was deleted.

eval/repos/continue

-1
This file was deleted.

eval/repos/the-x

-1
This file was deleted.

eval/repos/trayracer

-1
This file was deleted.

0 commit comments

Comments
 (0)