Skip to content

Commit 3f00eb1

Browse files
committed
Undo temporary 'using' keyword hack
1 parent 7e16947 commit 3f00eb1

File tree

3 files changed

+3
-41
lines changed

3 files changed

+3
-41
lines changed

l10n/bundle.l10n.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
"Unexpected error when attaching to C# preview window.": "Unexpected error when attaching to C# preview window.",
120120
"Razor C# copied to clipboard": "Razor C# copied to clipboard",
121121
"Copy C#": "Copy C#",
122-
"{0} Keyword": "{0} Keyword",
123122
"Unexpected completion trigger kind: {0}": "Unexpected completion trigger kind: {0}",
124123
"1 reference": "1 reference",
125124
"{0} references": "{0} references",

src/razor/src/completion/provisionalCompletionOrchestrator.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ export class ProvisionalCompletionOrchestrator {
134134
htmlPosition,
135135
provisionalPosition,
136136
completionContext,
137-
projection.languageKind,
138-
newDocument
137+
projection.languageKind
139138
);
140139

141140
// We track when we add provisional dots to avoid doing unnecessary work on commonly invoked events.

src/razor/src/completion/razorCompletionItemProvider.ts

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export class RazorCompletionItemProvider extends RazorLanguageFeatureBase implem
3030
hostDocumentPosition: vscode.Position,
3131
projectedPosition: vscode.Position,
3232
context: vscode.CompletionContext,
33-
language: LanguageKind,
34-
razorDocument: vscode.TextDocument
33+
language: LanguageKind
3534
) {
3635
if (projectedUri) {
3736
// "@" is not a valid trigger character for C# / HTML and therefore we need to translate
@@ -172,8 +171,6 @@ export class RazorCompletionItemProvider extends RazorLanguageFeatureBase implem
172171
}
173172
}
174173

175-
this.addUsingKeyword(language, razorDocument, hostDocumentPosition, completionItems);
176-
177174
const isIncomplete = completions instanceof Array ? false : completions ? completions.isIncomplete : false;
178175
return new vscode.CompletionList(completionItems, isIncomplete);
179176
}
@@ -229,8 +226,7 @@ export class RazorCompletionItemProvider extends RazorLanguageFeatureBase implem
229226
position,
230227
projection.position,
231228
context,
232-
projection.languageKind,
233-
document
229+
projection.languageKind
234230
);
235231

236232
return completionList;
@@ -287,38 +283,6 @@ export class RazorCompletionItemProvider extends RazorLanguageFeatureBase implem
287283

288284
return item;
289285
}
290-
291-
private static addUsingKeyword(
292-
language: LanguageKind,
293-
razorDocument: vscode.TextDocument,
294-
hostDocumentPosition: vscode.Position,
295-
completionItems: vscode.CompletionItem[]
296-
) {
297-
// This is an ugly hack, but it's needed to get the "using" keyword to show up in the completion list.
298-
// The reason it doesn't show up is because the C# generated document puts the position of the cursor
299-
// at '__o = [||]', which isn't a valid location for a using statement.
300-
if (language == LanguageKind.CSharp) {
301-
const line = razorDocument.lineAt(hostDocumentPosition.line);
302-
const lineText = line.text.substring(0, hostDocumentPosition.character);
303-
if (
304-
lineText.endsWith('@') ||
305-
lineText.endsWith(
306-
'@u' ||
307-
lineText.endsWith('@us') ||
308-
lineText.endsWith('@usi') ||
309-
lineText.endsWith('@usin') ||
310-
lineText.endsWith('@using')
311-
)
312-
) {
313-
const usingItem = new vscode.CompletionItem('using', vscode.CompletionItemKind.Keyword);
314-
315-
// Matching Roslyn's documentation behavior
316-
(<CompletionItem>usingItem).documentation = vscode.l10n.t('{0} Keyword', 'using');
317-
318-
completionItems.push(usingItem);
319-
}
320-
}
321-
}
322286
}
323287

324288
function getTriggerKind(triggerKind: vscode.CompletionTriggerKind): CompletionTriggerKind {

0 commit comments

Comments
 (0)