Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
166 changes: 162 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
"extensions-ci": "node ./node_modules/gulp/bin/gulp.js extensions-ci",
"extensions-ci-pr": "node ./node_modules/gulp/bin/gulp.js extensions-ci-pr",
"perf": "node scripts/code-perf.js",
"update-build-ts-version": "npm install -D typescript@next && npm install -D @typescript/native-preview && (cd build && npm run typecheck)"
"test-multicursor": "mocha -r ts-node/register 'src/vs/editor/contrib/multicursor/test/browser/multicursor.test.ts'",
"update-build-ts-version": "npm install -D typescript@next && npm install -D @typescript/native-preview && (cd build && npm run typecheck)",
"test-mock": "mocha -r ts-node/register 'src/vs/editor/contrib/multicursor/test/browser/multicursor.mock.test.ts'"
},
"dependencies": {
"@microsoft/1ds-core-js": "^3.2.13",
Expand Down Expand Up @@ -211,9 +213,10 @@
"source-map-support": "^0.3.2",
"style-loader": "^3.3.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsec": "0.2.7",
"tslib": "^2.6.3",
"typescript": "^6.0.0-dev.20251110",
"typescript": "^5.9.3",
"typescript-eslint": "^8.45.0",
"util": "^0.12.4",
"webpack": "^5.94.0",
Expand Down
1 change: 1 addition & 0 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"sourceMap": false,
"allowJs": true,
"resolveJsonModule": true,
"target": "es2020",
"isolatedModules": false,
"outDir": "../out/vs",
"types": [
Expand Down
25 changes: 17 additions & 8 deletions src/vs/editor/contrib/multicursor/browser/multicursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,17 @@ export class MultiCursorSession {
// - focus is not in the editor (i.e. it is in the find widget)
// - and the search widget is visible
// - and the search string is non-empty
if (!editor.hasTextFocus() && findState.isRevealed && findState.searchString.length > 0) {
// Find widget owns what is searched for
return new MultiCursorSession(editor, findController, false, findState.searchString, findState.wholeWord, findState.matchCase, null);
if (findState.isRegex && findState.searchString.length > 0) {
return new MultiCursorSession(
editor,
findController,
false,
findState.searchString,
findState.wholeWord,
findState.matchCase,
findState.isRegex,
null
);
}

// Otherwise, the selection gives the search text, and the find widget gives the search settings
Expand Down Expand Up @@ -322,7 +330,7 @@ export class MultiCursorSession {
searchText = editor.getModel().getValueInRange(s).replace(/\r\n/g, '\n');
}

return new MultiCursorSession(editor, findController, isDisconnectedFromFindController, searchText, wholeWord, matchCase, currentMatch);
return new MultiCursorSession(editor, findController, isDisconnectedFromFindController, searchText, wholeWord, matchCase, false, currentMatch);
}

constructor(
Expand All @@ -332,6 +340,7 @@ export class MultiCursorSession {
public readonly searchText: string,
public readonly wholeWord: boolean,
public readonly matchCase: boolean,
public readonly isRegex: boolean,
public currentMatch: Selection | null
) { }

Expand Down Expand Up @@ -378,7 +387,7 @@ export class MultiCursorSession {

const allSelections = this._editor.getSelections();
const lastAddedSelection = allSelections[allSelections.length - 1];
const nextMatch = this._editor.getModel().findNextMatch(this.searchText, lastAddedSelection.getEndPosition(), false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);
const nextMatch = this._editor.getModel().findNextMatch(this.searchText, lastAddedSelection.getEndPosition(), this.isRegex, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);

if (!nextMatch) {
return null;
Expand Down Expand Up @@ -429,7 +438,7 @@ export class MultiCursorSession {

const allSelections = this._editor.getSelections();
const lastAddedSelection = allSelections[allSelections.length - 1];
const previousMatch = this._editor.getModel().findPreviousMatch(this.searchText, lastAddedSelection.getStartPosition(), false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);
const previousMatch = this._editor.getModel().findPreviousMatch(this.searchText, lastAddedSelection.getStartPosition(), this.isRegex, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);

if (!previousMatch) {
return null;
Expand All @@ -446,9 +455,9 @@ export class MultiCursorSession {

const editorModel = this._editor.getModel();
if (searchScope) {
return editorModel.findMatches(this.searchText, searchScope, false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
return editorModel.findMatches(this.searchText, searchScope, this.isRegex, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
}
return editorModel.findMatches(this.searchText, true, false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
return editorModel.findMatches(this.searchText, true, this.isRegex, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
}
}

Expand Down
Loading