未验证 提交 f1560e9a 编写于 作者: J Johannes Rieken 提交者: GitHub

Merge pull request #110494 from usernamehw/word_suggestion_any_language

Add a setting to include word based suggestions regardless of the language
......@@ -502,6 +502,11 @@ const editorConfiguration: IConfigurationNode = {
default: true,
description: nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.")
},
'editor.wordBasedSuggestionsOnlySameLanguage': {
type: 'boolean',
default: true,
description: nls.localize('wordBasedSuggestionsOnlySameLanguage', "Controls whether word based completions should be included from opened documents of the same language or any language.")
},
'editor.semanticHighlighting.enabled': {
enum: [true, false, 'configuredByTheme'],
enumDescriptions: [
......
......@@ -148,7 +148,7 @@ class WordBasedCompletionItemProvider implements modes.CompletionItemProvider {
}
async provideCompletionItems(model: ITextModel, position: Position): Promise<modes.CompletionList | undefined> {
const { wordBasedSuggestions } = this._configurationService.getValue<{ wordBasedSuggestions?: boolean }>(model.uri, position, 'editor');
const { wordBasedSuggestions, wordBasedSuggestionsOnlySameLanguage } = this._configurationService.getValue<{ wordBasedSuggestions?: boolean, wordBasedSuggestionsOnlySameLanguage?: boolean }>(model.uri, position, 'editor');
if (!wordBasedSuggestions) {
return undefined;
}
......@@ -160,6 +160,8 @@ class WordBasedCompletionItemProvider implements modes.CompletionItemProvider {
}
if (candidate === model) {
models.unshift(candidate.uri);
} else if (!wordBasedSuggestionsOnlySameLanguage) {
models.push(candidate.uri);
} else if (candidate.getLanguageIdentifier().id === model.getLanguageIdentifier().id) {
models.push(candidate.uri);
}
......
......@@ -113,6 +113,10 @@ export interface IGlobalEditorOptions {
* Defaults to true.
*/
wordBasedSuggestions?: boolean;
/**
* Controls whether word based completions should be included from opened documents of the same language or any language.
*/
wordBasedSuggestionsOnlySameLanguage?: boolean;
/**
* Controls whether the semanticHighlighting is shown for the languages that support it.
* true: semanticHighlighting is enabled for all themes
......
......@@ -1115,6 +1115,10 @@ declare namespace monaco.editor {
* Defaults to true.
*/
wordBasedSuggestions?: boolean;
/**
* Controls whether word based completions should be included from opened documents of the same language or any language.
*/
wordBasedSuggestionsOnlySameLanguage?: boolean;
/**
* Controls whether the semanticHighlighting is shown for the languages that support it.
* true: semanticHighlighting is enabled for all themes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册