提交 ea55eda7 编写于 作者: M Matt Bierner

Mark TS optional fields with ? in suggestion list

Fixes #30334
上级 43548827
...@@ -17,6 +17,7 @@ import * as nls from 'vscode-nls'; ...@@ -17,6 +17,7 @@ import * as nls from 'vscode-nls';
import { applyCodeAction } from '../utils/codeAction'; import { applyCodeAction } from '../utils/codeAction';
import * as languageModeIds from '../utils/languageModeIds'; import * as languageModeIds from '../utils/languageModeIds';
import { CommandManager, Command } from '../utils/commandManager'; import { CommandManager, Command } from '../utils/commandManager';
import { TsServerLogLevel } from '../utils/configuration';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
...@@ -52,6 +53,12 @@ class MyCompletionItem extends CompletionItem { ...@@ -52,6 +53,12 @@ class MyCompletionItem extends CompletionItem {
if (tsEntry.replacementSpan) { if (tsEntry.replacementSpan) {
this.range = tsTextSpanToVsRange(tsEntry.replacementSpan); this.range = tsTextSpanToVsRange(tsEntry.replacementSpan);
} }
if (tsEntry.kindModifiers.match(/\boptional\b/)) {
this.insertText = this.label;
this.filterText = this.label;
this.label += '?';
}
} }
public resolve(): void { public resolve(): void {
...@@ -188,7 +195,7 @@ class ApplyCompletionCodeActionCommand implements Command { ...@@ -188,7 +195,7 @@ class ApplyCompletionCodeActionCommand implements Command {
} }
interface Configuration { interface Configuration {
useCodeSnippetsOnMethodSuggest: boolean; useCodeSnippetsOnMethodShowest: boolean;
nameSuggestions: boolean; nameSuggestions: boolean;
quickSuggestionsForPaths: boolean; quickSuggestionsForPaths: boolean;
autoImportSuggestions: boolean; autoImportSuggestions: boolean;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册