Skip to content

Commit 8ad4d44

Browse files
monaco: Filter out legacy variables from autocomplete suggestions
1 parent 6607bfc commit 8ad4d44

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libs/monaco-manager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function rebuildVariablesCache(): void {
154154
}
155155

156156
/**
157-
* Register completion providers for JavaScript.
157+
* Register completion providers for JavaScript and plaintext.
158158
* The provider checks the model's registered completion type to determine behavior.
159159
*/
160160
function registerCompletionProviders(): void {
@@ -193,8 +193,9 @@ function registerCompletionProviders(): void {
193193
endColumn: position.column,
194194
}
195195

196+
const nonLegacy = Object.entries(cachedVariablesMap).filter(([, v]) => !(v.name || '').includes('(Legacy)'))
196197
return {
197-
suggestions: Object.entries(cachedVariablesMap).map(([id, variable]) => ({
198+
suggestions: nonLegacy.map(([id, variable]) => ({
198199
label: variable.name || id,
199200
kind: monaco.languages.CompletionItemKind.Variable,
200201
documentation: `${variable.type}${variable.description ? ` - ${variable.description}` : ''} (${id})`,
@@ -212,8 +213,9 @@ function registerCompletionProviders(): void {
212213
endColumn: position.column,
213214
}
214215

216+
const nonLegacy = Object.entries(cachedVariablesMap).filter(([, v]) => !(v.name || '').includes('(Legacy)'))
215217
return {
216-
suggestions: Object.entries(cachedVariablesMap).map(([id, variable]) => ({
218+
suggestions: nonLegacy.map(([id, variable]) => ({
217219
label: variable.name || id,
218220
kind: monaco.languages.CompletionItemKind.Variable,
219221
insertText: ` ${id} }}`,

0 commit comments

Comments
 (0)