Skip to content

Commit f76ca9f

Browse files
authored
Merge pull request #92597 from microsoft/octref/live-rename
On Type Rename for #88424
2 parents 1c2c8ba + 196562b commit f76ca9f

14 files changed

+1064
-83
lines changed

src/vs/editor/common/config/editorOptions.ts

+10
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ export interface IEditorOptions {
135135
* Defaults to false.
136136
*/
137137
readOnly?: boolean;
138+
/**
139+
* Rename matching regions on type.
140+
* Defaults to false.
141+
*/
142+
renameOnType?: boolean;
138143
/**
139144
* Should the editor render validation decorations.
140145
* Defaults to editable.
@@ -3374,6 +3379,7 @@ export const enum EditorOption {
33743379
quickSuggestions,
33753380
quickSuggestionsDelay,
33763381
readOnly,
3382+
renameOnType,
33773383
renderControlCharacters,
33783384
renderIndentGuides,
33793385
renderFinalNewline,
@@ -3790,6 +3796,10 @@ export const EditorOptions = {
37903796
readOnly: register(new EditorBooleanOption(
37913797
EditorOption.readOnly, 'readOnly', false,
37923798
)),
3799+
renameOnType: register(new EditorBooleanOption(
3800+
EditorOption.renameOnType, 'renameOnType', false,
3801+
{ description: nls.localize('renameOnType', "Controls whether the editor auto renames on type.") }
3802+
)),
37933803
renderControlCharacters: register(new EditorBooleanOption(
37943804
EditorOption.renderControlCharacters, 'renderControlCharacters', false,
37953805
{ description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters.") }

src/vs/editor/common/modes.ts

+19
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,20 @@ export interface DocumentHighlightProvider {
789789
provideDocumentHighlights(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
790790
}
791791

792+
/**
793+
* The rename provider interface defines the contract between extensions and
794+
* the live-rename feature.
795+
*/
796+
export interface OnTypeRenameProvider {
797+
798+
stopPattern?: RegExp;
799+
800+
/**
801+
* Provide a list of ranges that can be live-renamed together.
802+
*/
803+
provideOnTypeRenameRanges(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<IRange[]>;
804+
}
805+
792806
/**
793807
* Value-object that contains additional information when
794808
* requesting references.
@@ -1642,6 +1656,11 @@ export const DocumentSymbolProviderRegistry = new LanguageFeatureRegistry<Docume
16421656
*/
16431657
export const DocumentHighlightProviderRegistry = new LanguageFeatureRegistry<DocumentHighlightProvider>();
16441658

1659+
/**
1660+
* @internal
1661+
*/
1662+
export const OnTypeRenameProviderRegistry = new LanguageFeatureRegistry<OnTypeRenameProvider>();
1663+
16451664
/**
16461665
* @internal
16471666
*/

src/vs/editor/common/standalone/standaloneEnums.ts

+42-41
Original file line numberDiff line numberDiff line change
@@ -238,47 +238,48 @@ export enum EditorOption {
238238
quickSuggestions = 70,
239239
quickSuggestionsDelay = 71,
240240
readOnly = 72,
241-
renderControlCharacters = 73,
242-
renderIndentGuides = 74,
243-
renderFinalNewline = 75,
244-
renderLineHighlight = 76,
245-
renderValidationDecorations = 77,
246-
renderWhitespace = 78,
247-
revealHorizontalRightPadding = 79,
248-
roundedSelection = 80,
249-
rulers = 81,
250-
scrollbar = 82,
251-
scrollBeyondLastColumn = 83,
252-
scrollBeyondLastLine = 84,
253-
scrollPredominantAxis = 85,
254-
selectionClipboard = 86,
255-
selectionHighlight = 87,
256-
selectOnLineNumbers = 88,
257-
showFoldingControls = 89,
258-
showUnused = 90,
259-
snippetSuggestions = 91,
260-
smoothScrolling = 92,
261-
stopRenderingLineAfter = 93,
262-
suggest = 94,
263-
suggestFontSize = 95,
264-
suggestLineHeight = 96,
265-
suggestOnTriggerCharacters = 97,
266-
suggestSelection = 98,
267-
tabCompletion = 99,
268-
useTabStops = 100,
269-
wordSeparators = 101,
270-
wordWrap = 102,
271-
wordWrapBreakAfterCharacters = 103,
272-
wordWrapBreakBeforeCharacters = 104,
273-
wordWrapColumn = 105,
274-
wordWrapMinified = 106,
275-
wrappingIndent = 107,
276-
wrappingStrategy = 108,
277-
editorClassName = 109,
278-
pixelRatio = 110,
279-
tabFocusMode = 111,
280-
layoutInfo = 112,
281-
wrappingInfo = 113
241+
renameOnType = 73,
242+
renderControlCharacters = 74,
243+
renderIndentGuides = 75,
244+
renderFinalNewline = 76,
245+
renderLineHighlight = 77,
246+
renderValidationDecorations = 78,
247+
renderWhitespace = 79,
248+
revealHorizontalRightPadding = 80,
249+
roundedSelection = 81,
250+
rulers = 82,
251+
scrollbar = 83,
252+
scrollBeyondLastColumn = 84,
253+
scrollBeyondLastLine = 85,
254+
scrollPredominantAxis = 86,
255+
selectionClipboard = 87,
256+
selectionHighlight = 88,
257+
selectOnLineNumbers = 89,
258+
showFoldingControls = 90,
259+
showUnused = 91,
260+
snippetSuggestions = 92,
261+
smoothScrolling = 93,
262+
stopRenderingLineAfter = 94,
263+
suggest = 95,
264+
suggestFontSize = 96,
265+
suggestLineHeight = 97,
266+
suggestOnTriggerCharacters = 98,
267+
suggestSelection = 99,
268+
tabCompletion = 100,
269+
useTabStops = 101,
270+
wordSeparators = 102,
271+
wordWrap = 103,
272+
wordWrapBreakAfterCharacters = 104,
273+
wordWrapBreakBeforeCharacters = 105,
274+
wordWrapColumn = 106,
275+
wordWrapMinified = 107,
276+
wrappingIndent = 108,
277+
wrappingStrategy = 109,
278+
editorClassName = 110,
279+
pixelRatio = 111,
280+
tabFocusMode = 112,
281+
layoutInfo = 113,
282+
wrappingInfo = 114
282283
}
283284

284285
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
.monaco-editor .on-type-rename-decoration {
7+
background: rgba(255, 0, 0, 0.3);
8+
border-left: 1px solid rgba(255, 0, 0, 0.3);
9+
/* So border can be transparent */
10+
background-clip: padding-box;
11+
}

0 commit comments

Comments
 (0)