Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge x-doc and occurrence setting, merge word based suggestion settings #197690

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/vs/editor/common/config/editorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,10 @@ export interface IEditorOptions {
*/
occurrencesHighlight?: boolean;
Yoyokrazy marked this conversation as resolved.
Show resolved Hide resolved
/**
* Enable semantic occurrences highlight.
* Defaults to true.
* Sets the mode for occurrence highlighting..
* Defaults to 'singleFile'.
*/
multiDocumentOccurrencesHighlight?: boolean;
occurrencesHighlightMode?: 'singleFile' | 'multiFile';
/**
* Show code lens
* Defaults to true.
Expand Down Expand Up @@ -5121,8 +5121,8 @@ export const enum EditorOption {
multiCursorModifier,
multiCursorPaste,
multiCursorLimit,
multiDocumentOccurrencesHighlight,
occurrencesHighlight,
occurrencesHighlightMode,
overviewRulerBorder,
overviewRulerLanes,
padding,
Expand Down Expand Up @@ -5622,9 +5622,17 @@ export const EditorOptions = {
EditorOption.occurrencesHighlight, 'occurrencesHighlight', true,
{ description: nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.") }
)),
multiDocumentOccurrencesHighlight: register(new EditorBooleanOption(
EditorOption.multiDocumentOccurrencesHighlight, 'multiDocumentOccurrencesHighlight', false,
{ description: nls.localize('multiDocumentOccurrencesHighlight', "Experimental: Controls whether the editor should highlight word occurrences accross multiple open editors.") }
occurrencesHighlightMode: register(new EditorStringEnumOption(
EditorOption.occurrencesHighlightMode, 'occurrencesHighlightMode',
'singleFile' as 'singleFile' | 'multiFile',
['singleFile', 'multiFile'] as const,
{
markdownEnumDescriptions: [
nls.localize('occurrencesHighlightMode.singleFile', "Highlights occurrences only in the current file."),
nls.localize('occurrencesHighlightMode.multiFile', "Experimental: Highlights occurrences across all valid open files.")
],
markdownDescription: nls.localize('occurrencesHighlightMode', "Controls whether occurrences should be highlighted across multiple files.")
}
)),
overviewRulerBorder: register(new EditorBooleanOption(
EditorOption.overviewRulerBorder, 'overviewRulerBorder', true,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/common/standalone/standaloneEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ export enum EditorOption {
multiCursorModifier = 77,
multiCursorPaste = 78,
multiCursorLimit = 79,
multiDocumentOccurrencesHighlight = 80,
occurrencesHighlight = 81,
occurrencesHighlight = 80,
occurrencesHighlightMode = 81,
overviewRulerBorder = 82,
overviewRulerLanes = 83,
padding = 84,
Expand Down
12 changes: 6 additions & 6 deletions src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class WordHighlighter {
private readonly providers: LanguageFeatureRegistry<DocumentHighlightProvider>;
private readonly multiDocumentProviders: LanguageFeatureRegistry<MultiDocumentHighlightProvider>;
private occurrencesHighlight: boolean;
private multiDocumentOccurrencesHighlight: boolean;
private occurrencesHighlightMode: 'singleFile' | 'multiFile';
private readonly model: ITextModel;
private readonly decorations: IEditorDecorationsCollection;
private readonly toUnhook = new DisposableStore();
Expand Down Expand Up @@ -285,7 +285,7 @@ class WordHighlighter {
this._hasWordHighlights = ctxHasWordHighlights.bindTo(contextKeyService);
this._ignorePositionChangeEvent = false;
this.occurrencesHighlight = this.editor.getOption(EditorOption.occurrencesHighlight);
this.multiDocumentOccurrencesHighlight = this.editor.getOption(EditorOption.multiDocumentOccurrencesHighlight);
this.occurrencesHighlightMode = this.editor.getOption(EditorOption.occurrencesHighlightMode);
this.model = this.editor.getModel();
this.toUnhook.add(editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {
if (this._ignorePositionChangeEvent) {
Expand Down Expand Up @@ -320,9 +320,9 @@ class WordHighlighter {
this._stopAll();
}

const newMultiDocumentValue = this.editor.getOption(EditorOption.multiDocumentOccurrencesHighlight);
if (this.multiDocumentOccurrencesHighlight !== newMultiDocumentValue) {
this.multiDocumentOccurrencesHighlight = newMultiDocumentValue;
const newMultiDocumentValue = this.editor.getOption(EditorOption.occurrencesHighlightMode);
if (this.occurrencesHighlightMode !== newMultiDocumentValue) {
this.occurrencesHighlightMode = newMultiDocumentValue;
this._stopAll();
}
}));
Expand Down Expand Up @@ -586,7 +586,7 @@ class WordHighlighter {
}

// multi-doc OFF
if (!this.multiDocumentOccurrencesHighlight) {
if (this.occurrencesHighlightMode === 'singleFile') {
return [];
}

Expand Down
12 changes: 6 additions & 6 deletions src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3540,10 +3540,10 @@ declare namespace monaco.editor {
*/
occurrencesHighlight?: boolean;
/**
* Enable semantic occurrences highlight.
* Defaults to true.
* Sets the mode for occurrence highlighting..
* Defaults to 'singleFile'.
*/
multiDocumentOccurrencesHighlight?: boolean;
occurrencesHighlightMode?: 'singleFile' | 'multiFile';
/**
* Show code lens
* Defaults to true.
Expand Down Expand Up @@ -4799,8 +4799,8 @@ declare namespace monaco.editor {
multiCursorModifier = 77,
multiCursorPaste = 78,
multiCursorLimit = 79,
multiDocumentOccurrencesHighlight = 80,
occurrencesHighlight = 81,
occurrencesHighlight = 80,
occurrencesHighlightMode = 81,
overviewRulerBorder = 82,
overviewRulerLanes = 83,
padding = 84,
Expand Down Expand Up @@ -4954,7 +4954,7 @@ declare namespace monaco.editor {
multiCursorPaste: IEditorOption<EditorOption.multiCursorPaste, 'spread' | 'full'>;
multiCursorLimit: IEditorOption<EditorOption.multiCursorLimit, number>;
occurrencesHighlight: IEditorOption<EditorOption.occurrencesHighlight, boolean>;
multiDocumentOccurrencesHighlight: IEditorOption<EditorOption.multiDocumentOccurrencesHighlight, boolean>;
occurrencesHighlightMode: IEditorOption<EditorOption.occurrencesHighlightMode, 'singleFile' | 'multiFile'>;
overviewRulerBorder: IEditorOption<EditorOption.overviewRulerBorder, boolean>;
overviewRulerLanes: IEditorOption<EditorOption.overviewRulerLanes, number>;
padding: IEditorOption<EditorOption.padding, Readonly<Required<IEditorPaddingOptions>>>;
Expand Down
Loading