@codingame/monaco-vscode-search-service-override 1.82.6 → 1.83.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +3 -3
- package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +3 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +21 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +40 -30
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +6 -5
- package/vscode/src/vs/workbench/services/search/common/searchService.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-search-service-override",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.83.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"private": false,
|
|
16
|
-
"description": "VSCode public API plugged on the monaco editor - search service-override
|
|
16
|
+
"description": "VSCode public API plugged on the monaco editor - search service-override",
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.
|
|
22
|
-
"monaco-editor": "0.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.83.1",
|
|
22
|
+
"monaco-editor": "0.44.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -36,7 +36,7 @@ import { SymbolsQuickAccessProvider } from './symbolsQuickAccess.js';
|
|
|
36
36
|
import { DefaultQuickAccessFilterValue, Extensions } from 'monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js';
|
|
37
37
|
import { GotoSymbolQuickAccessProvider } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess';
|
|
38
38
|
import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
39
|
-
import {
|
|
39
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
40
40
|
import { getIEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
41
41
|
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
42
42
|
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
@@ -108,7 +108,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
108
108
|
}
|
|
109
109
|
set(picker) {
|
|
110
110
|
this.picker = picker;
|
|
111
|
-
once(picker.onDispose)(() => {
|
|
111
|
+
Event.once(picker.onDispose)(() => {
|
|
112
112
|
if (picker === this.picker) {
|
|
113
113
|
this.picker = undefined;
|
|
114
114
|
}
|
|
@@ -180,7 +180,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
180
180
|
editorDecorationsDisposable.value = this.decorateAndRevealSymbolRange(item);
|
|
181
181
|
}
|
|
182
182
|
}));
|
|
183
|
-
disposables.add(once(picker.onDidHide)(({ reason }) => {
|
|
183
|
+
disposables.add(Event.once(picker.onDidHide)(({ reason }) => {
|
|
184
184
|
if (reason === QuickInputHideReason.Gesture) {
|
|
185
185
|
this.pickState.restoreEditorViewState();
|
|
186
186
|
}
|
package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { ResourceSet } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
3
4
|
import { basenameOrAuthority, dirname } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
4
5
|
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
5
6
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
@@ -95,7 +96,8 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
95
96
|
const result = this.searchModel.search(query, undefined, token);
|
|
96
97
|
const getAsyncResults = async () => {
|
|
97
98
|
await result.asyncResults;
|
|
98
|
-
|
|
99
|
+
const syncResultURIs = ( new ResourceSet(( result.syncResults.map(e => e.resource))));
|
|
100
|
+
return this.searchModel.searchResult.matches().filter(e => !( syncResultURIs.has(e.resource)));
|
|
99
101
|
};
|
|
100
102
|
return {
|
|
101
103
|
syncResults: this.searchModel.searchResult.matches(),
|
|
@@ -4,6 +4,9 @@ import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/
|
|
|
4
4
|
import { category } from './searchActionsBase.js';
|
|
5
5
|
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
6
6
|
import { TEXT_SEARCH_QUICK_ACCESS_PREFIX } from './quickTextSearch/textSearchQuickAccess.js';
|
|
7
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
8
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
9
|
+
import { getSelectionTextFromEditor } from './searchView.js';
|
|
7
10
|
|
|
8
11
|
registerAction2(class TextSearchQuickAccessAction extends Action2 {
|
|
9
12
|
constructor() {
|
|
@@ -19,6 +22,23 @@ registerAction2(class TextSearchQuickAccessAction extends Action2 {
|
|
|
19
22
|
}
|
|
20
23
|
async run(accessor, match) {
|
|
21
24
|
const quickInputService = accessor.get(IQuickInputService);
|
|
22
|
-
|
|
25
|
+
const searchText = getSearchText(accessor) ?? '';
|
|
26
|
+
quickInputService.quickAccess.show(TEXT_SEARCH_QUICK_ACCESS_PREFIX + searchText, { preserveValue: !!searchText });
|
|
23
27
|
}
|
|
24
28
|
});
|
|
29
|
+
function getSearchText(accessor) {
|
|
30
|
+
const editorService = accessor.get(IEditorService);
|
|
31
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
32
|
+
const activeEditor = editorService.activeTextEditorControl;
|
|
33
|
+
if (!activeEditor) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (!activeEditor.hasTextFocus()) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const seedSearchStringFromSelection = configurationService.getValue('editor.find.seedSearchStringFromSelection');
|
|
40
|
+
if (!seedSearchStringFromSelection) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return getSelectionTextFromEditor(false, activeEditor);
|
|
44
|
+
}
|
|
@@ -1096,37 +1096,11 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
1096
1096
|
editor = editor.getModifiedEditor();
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
|
-
if (!
|
|
1099
|
+
if (!editor) {
|
|
1100
1100
|
return null;
|
|
1101
1101
|
}
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
return null;
|
|
1105
|
-
}
|
|
1106
|
-
if (range.isEmpty() && this.searchConfig.seedWithNearestWord && allowUnselectedWord) {
|
|
1107
|
-
const wordAtPosition = editor.getModel().getWordAtPosition(range.getStartPosition());
|
|
1108
|
-
if (wordAtPosition) {
|
|
1109
|
-
return wordAtPosition.word;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
if (!range.isEmpty()) {
|
|
1113
|
-
let searchText = '';
|
|
1114
|
-
for (let i = range.startLineNumber; i <= range.endLineNumber; i++) {
|
|
1115
|
-
let lineText = editor.getModel().getLineContent(i);
|
|
1116
|
-
if (i === range.endLineNumber) {
|
|
1117
|
-
lineText = lineText.substring(0, range.endColumn - 1);
|
|
1118
|
-
}
|
|
1119
|
-
if (i === range.startLineNumber) {
|
|
1120
|
-
lineText = lineText.substring(range.startColumn - 1);
|
|
1121
|
-
}
|
|
1122
|
-
if (i !== range.startLineNumber) {
|
|
1123
|
-
lineText = '\n' + lineText;
|
|
1124
|
-
}
|
|
1125
|
-
searchText += lineText;
|
|
1126
|
-
}
|
|
1127
|
-
return searchText;
|
|
1128
|
-
}
|
|
1129
|
-
return null;
|
|
1102
|
+
const allowUnselected = this.searchConfig.seedWithNearestWord && allowUnselectedWord;
|
|
1103
|
+
return getSelectionTextFromEditor(allowUnselected, editor);
|
|
1130
1104
|
}
|
|
1131
1105
|
showsFileTypes() {
|
|
1132
1106
|
return this.queryDetails.classList.contains('more');
|
|
@@ -1802,6 +1776,9 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
1802
1776
|
super.saveState();
|
|
1803
1777
|
}
|
|
1804
1778
|
_saveSearchHistoryService() {
|
|
1779
|
+
if (this.searchWidget === undefined) {
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1805
1782
|
const history = Object.create(null);
|
|
1806
1783
|
const searchHistory = this.searchWidget.getSearchHistory();
|
|
1807
1784
|
if (searchHistory && searchHistory.length) {
|
|
@@ -1914,5 +1891,38 @@ function getEditorSelectionFromMatch(element, viewModel) {
|
|
|
1914
1891
|
}
|
|
1915
1892
|
return undefined;
|
|
1916
1893
|
}
|
|
1894
|
+
function getSelectionTextFromEditor(allowUnselectedWord, editor) {
|
|
1895
|
+
if (!isCodeEditor(editor) || !editor.hasModel()) {
|
|
1896
|
+
return null;
|
|
1897
|
+
}
|
|
1898
|
+
const range = editor.getSelection();
|
|
1899
|
+
if (!range) {
|
|
1900
|
+
return null;
|
|
1901
|
+
}
|
|
1902
|
+
if (range.isEmpty()) {
|
|
1903
|
+
if (allowUnselectedWord) {
|
|
1904
|
+
const wordAtPosition = editor.getModel().getWordAtPosition(range.getStartPosition());
|
|
1905
|
+
return wordAtPosition?.word ?? null;
|
|
1906
|
+
}
|
|
1907
|
+
else {
|
|
1908
|
+
return null;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
let searchText = '';
|
|
1912
|
+
for (let i = range.startLineNumber; i <= range.endLineNumber; i++) {
|
|
1913
|
+
let lineText = editor.getModel().getLineContent(i);
|
|
1914
|
+
if (i === range.endLineNumber) {
|
|
1915
|
+
lineText = lineText.substring(0, range.endColumn - 1);
|
|
1916
|
+
}
|
|
1917
|
+
if (i === range.startLineNumber) {
|
|
1918
|
+
lineText = lineText.substring(range.startColumn - 1);
|
|
1919
|
+
}
|
|
1920
|
+
if (i !== range.startLineNumber) {
|
|
1921
|
+
lineText = '\n' + lineText;
|
|
1922
|
+
}
|
|
1923
|
+
searchText += lineText;
|
|
1924
|
+
}
|
|
1925
|
+
return searchText;
|
|
1926
|
+
}
|
|
1917
1927
|
|
|
1918
|
-
export { SearchView, getEditorSelectionFromMatch };
|
|
1928
|
+
export { SearchView, getEditorSelectionFromMatch, getSelectionTextFromEditor };
|
|
@@ -8,6 +8,7 @@ import { createTextBufferFactoryFromStream } from 'monaco-editor/esm/vs/editor/c
|
|
|
8
8
|
import { SearchEditorWorkingCopyTypeId } from './constants.js';
|
|
9
9
|
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
10
10
|
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
11
|
+
import { SEARCH_RESULT_LANGUAGE_ID } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
11
12
|
|
|
12
13
|
class SearchConfigurationModel {
|
|
13
14
|
constructor(config) {
|
|
@@ -47,7 +48,7 @@ class SearchEditorModelFactory {
|
|
|
47
48
|
return backup;
|
|
48
49
|
}
|
|
49
50
|
return Promise.resolve({
|
|
50
|
-
resultsModel: modelService.getModel(resource) ?? modelService.createModel('', languageService.createById(
|
|
51
|
+
resultsModel: modelService.getModel(resource) ?? modelService.createModel('', languageService.createById(SEARCH_RESULT_LANGUAGE_ID), resource),
|
|
51
52
|
configurationModel: ( new SearchConfigurationModel(config))
|
|
52
53
|
});
|
|
53
54
|
})();
|
|
@@ -74,7 +75,7 @@ class SearchEditorModelFactory {
|
|
|
74
75
|
return backup;
|
|
75
76
|
}
|
|
76
77
|
return Promise.resolve({
|
|
77
|
-
resultsModel: modelService.createModel(contents ?? '', languageService.createById(
|
|
78
|
+
resultsModel: modelService.createModel(contents ?? '', languageService.createById(SEARCH_RESULT_LANGUAGE_ID), resource),
|
|
78
79
|
configurationModel: ( new SearchConfigurationModel(config))
|
|
79
80
|
});
|
|
80
81
|
})();
|
|
@@ -102,7 +103,7 @@ class SearchEditorModelFactory {
|
|
|
102
103
|
}
|
|
103
104
|
const { text, config } = await instantiationService.invokeFunction(parseSavedSearchEditor, existingFile);
|
|
104
105
|
return ({
|
|
105
|
-
resultsModel: modelService.createModel(text ?? '', languageService.createById(
|
|
106
|
+
resultsModel: modelService.createModel(text ?? '', languageService.createById(SEARCH_RESULT_LANGUAGE_ID), resource),
|
|
106
107
|
configurationModel: ( new SearchConfigurationModel(config))
|
|
107
108
|
});
|
|
108
109
|
})();
|
|
@@ -116,14 +117,14 @@ class SearchEditorModelFactory {
|
|
|
116
117
|
let model = modelService.getModel(resource);
|
|
117
118
|
if (!model && backup) {
|
|
118
119
|
const factory = await createTextBufferFactoryFromStream(backup.value);
|
|
119
|
-
model = modelService.createModel(factory, languageService.createById(
|
|
120
|
+
model = modelService.createModel(factory, languageService.createById(SEARCH_RESULT_LANGUAGE_ID), resource);
|
|
120
121
|
}
|
|
121
122
|
if (model) {
|
|
122
123
|
const existingFile = model.getValue();
|
|
123
124
|
const { text, config } = parseSerializedSearchEditor(existingFile);
|
|
124
125
|
modelService.destroyModel(resource);
|
|
125
126
|
return ({
|
|
126
|
-
resultsModel: modelService.createModel(text ?? '', languageService.createById(
|
|
127
|
+
resultsModel: modelService.createModel(text ?? '', languageService.createById(SEARCH_RESULT_LANGUAGE_ID), resource),
|
|
127
128
|
configurationModel: ( new SearchConfigurationModel(config))
|
|
128
129
|
});
|
|
129
130
|
}
|
|
@@ -15,7 +15,7 @@ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/c
|
|
|
15
15
|
import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
16
16
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
17
17
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
18
|
-
import { deserializeSearchError, SearchErrorCode, FileMatch, pathIncludedInQuery, isFileMatch, isProgressMessage } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
18
|
+
import { deserializeSearchError, SearchErrorCode, SEARCH_RESULT_LANGUAGE_ID, FileMatch, pathIncludedInQuery, isFileMatch, isProgressMessage } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
19
19
|
import { editorMatchesToTextSearchResults, addContextToEditorMatches } from 'vscode/vscode/vs/workbench/services/search/common/searchHelpers';
|
|
20
20
|
|
|
21
21
|
let SearchService = class SearchService extends Disposable {
|
|
@@ -316,7 +316,7 @@ let SearchService = class SearchService extends Disposable {
|
|
|
316
316
|
if (!originalResource) {
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
|
-
if (model.getLanguageId() ===
|
|
319
|
+
if (model.getLanguageId() === SEARCH_RESULT_LANGUAGE_ID && !(query.includePattern && query.includePattern['**/*.code-search'])) {
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
322
|
if (originalResource.scheme !== Schemas.untitled && !this.fileService.hasProvider(originalResource)) {
|