Skip to content

Commit 707d8e9

Browse files
committed
Merge branch 'master' into sandy081/wip
2 parents 78b8a7e + dfd849b commit 707d8e9

170 files changed

Lines changed: 6002 additions & 13682 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/monaco/monaco.d.ts.recipe

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export interface ICommandHandler {
6262
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
6363
#includeAll(vs/editor/common/model/textModelEvents):
6464
#includeAll(vs/editor/common/controller/cursorEvents):
65-
#include(vs/platform/accessibility/common/accessibility): AccessibilitySupport
6665
#includeAll(vs/editor/common/config/editorOptions):
6766
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
6867
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo

build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"request": "^2.85.0",
4141
"terser": "4.3.8",
4242
"tslint": "^5.9.1",
43-
"typescript": "3.7.2",
43+
"typescript": "3.7.3",
4444
"vsce": "1.48.0",
4545
"vscode-telemetry-extractor": "^1.5.4",
4646
"xml2js": "^0.4.17"

build/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,10 +2441,10 @@ typed-rest-client@^0.9.0:
24412441
tunnel "0.0.4"
24422442
underscore "1.8.3"
24432443

2444-
typescript@3.7.2:
2445-
version "3.7.2"
2446-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
2447-
integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==
2444+
typescript@3.7.3:
2445+
version "3.7.3"
2446+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69"
2447+
integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==
24482448

24492449
typescript@^3.0.1:
24502450
version "3.5.3"

extensions/markdown-language-features/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
"mocha-junit-reporter": "^1.17.0",
346346
"mocha-multi-reporters": "^1.1.7",
347347
"ts-loader": "^6.2.1",
348-
"typescript": "^3.7.2",
348+
"typescript": "^3.7.3",
349349
"vscode": "^1.1.10",
350350
"webpack": "^4.41.2",
351351
"webpack-cli": "^3.3.0"

extensions/markdown-language-features/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4528,10 +4528,10 @@ typedarray@^0.0.6:
45284528
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
45294529
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
45304530

4531-
typescript@^3.7.2:
4532-
version "3.7.2"
4533-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
4534-
integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==
4531+
typescript@^3.7.3:
4532+
version "3.7.3"
4533+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69"
4534+
integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==
45354535

45364536
uc.micro@^1.0.1:
45374537
version "1.0.3"

extensions/perl/perl.language-configuration.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
],
2626
"folding": {
2727
"markers": {
28-
"start": "^=pod\\s*$",
29-
"end": "^=cut\\s*$"
28+
"start": "^(?:(?:=pod\\s*$)|(?:\\s*#region\\b))",
29+
"end": "^(?:(?:=cut\\s*$)|(?:\\s*#endregion\\b))"
3030
}
3131
}
3232
}

extensions/search-result/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"*"
1717
],
1818
"scripts": {
19-
"update-grammar": "node ./syntaxes/generateTMLanguage.js",
19+
"generate-grammar": "node ./syntaxes/generateTMLanguage.js",
2020
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:search-result ./tsconfig.json"
2121
},
2222
"contributes": {

extensions/search-result/src/extension.ts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,27 @@ const SEARCH_RESULT_SELECTOR = { language: 'search-result' };
1212
const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:'];
1313
const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch'];
1414

15-
let cachedLastParse: { version: number, parse: ParsedSearchResults } | undefined;
15+
let cachedLastParse: { version: number, parse: ParsedSearchResults, uri: vscode.Uri } | undefined;
16+
let documentChangeListener: vscode.Disposable | undefined;
17+
1618

1719
export function activate(context: vscode.ExtensionContext) {
20+
21+
const contextLineDecorations = vscode.window.createTextEditorDecorationType({ opacity: '0.7' });
22+
const matchLineDecorations = vscode.window.createTextEditorDecorationType({ fontWeight: 'bold' });
23+
24+
const decorate = (editor: vscode.TextEditor) => {
25+
const parsed = parseSearchResults(editor.document).filter(isResultLine);
26+
const contextRanges = parsed.filter(line => line.isContext).map(line => line.prefixRange);
27+
const matchRanges = parsed.filter(line => !line.isContext).map(line => line.prefixRange);
28+
editor.setDecorations(contextLineDecorations, contextRanges);
29+
editor.setDecorations(matchLineDecorations, matchRanges);
30+
};
31+
32+
if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.languageId === 'search-result') {
33+
decorate(vscode.window.activeTextEditor);
34+
}
35+
1836
context.subscriptions.push(
1937
vscode.commands.registerCommand('searchResult.rerunSearch', () => vscode.commands.executeCommand('search.action.rerunEditorSearch')),
2038
vscode.commands.registerCommand('searchResult.rerunSearchWithContext', () => vscode.commands.executeCommand('search.action.rerunEditorSearchWithContext')),
@@ -84,15 +102,24 @@ export function activate(context: vscode.ExtensionContext) {
84102
}
85103
}),
86104

87-
vscode.window.onDidChangeActiveTextEditor(e => {
88-
if (e?.document.languageId === 'search-result') {
105+
vscode.window.onDidChangeActiveTextEditor(editor => {
106+
if (editor?.document.languageId === 'search-result') {
89107
// Clear the parse whenever we open a new editor.
90108
// Conservative because things like the URI might remain constant even if the contents change, and re-parsing even large files is relatively fast.
91109
cachedLastParse = undefined;
110+
111+
documentChangeListener?.dispose();
112+
documentChangeListener = vscode.workspace.onDidChangeTextDocument(doc => {
113+
if (doc.document.uri === editor.document.uri) {
114+
decorate(editor);
115+
}
116+
});
117+
118+
decorate(editor);
92119
}
93120
}),
94121

95-
{ dispose() { cachedLastParse = undefined; } }
122+
{ dispose() { cachedLastParse = undefined; documentChangeListener?.dispose(); } }
96123
);
97124
}
98125

@@ -129,14 +156,15 @@ function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | u
129156
}
130157

131158
type ParsedSearchFileLine = { type: 'file', location: vscode.LocationLink, allLocations: vscode.LocationLink[], path: string };
132-
type ParsedSearchResultLine = { type: 'result', location: vscode.LocationLink };
159+
type ParsedSearchResultLine = { type: 'result', location: vscode.LocationLink, isContext: boolean, prefixRange: vscode.Range };
133160
type ParsedSearchResults = Array<ParsedSearchFileLine | ParsedSearchResultLine>;
134161
const isFileLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchFileLine => line.type === 'file';
162+
const isResultLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchResultLine => line.type === 'result';
135163

136164

137-
function parseSearchResults(document: vscode.TextDocument, token: vscode.CancellationToken): ParsedSearchResults {
165+
function parseSearchResults(document: vscode.TextDocument, token?: vscode.CancellationToken): ParsedSearchResults {
138166

139-
if (cachedLastParse && cachedLastParse.version === document.version) {
167+
if (cachedLastParse && cachedLastParse.uri === document.uri && cachedLastParse.version === document.version) {
140168
return cachedLastParse.parse;
141169
}
142170

@@ -147,7 +175,8 @@ function parseSearchResults(document: vscode.TextDocument, token: vscode.Cancell
147175
let currentTargetLocations: vscode.LocationLink[] | undefined = undefined;
148176

149177
for (let i = 0; i < lines.length; i++) {
150-
if (token.isCancellationRequested) { return []; }
178+
// TODO: This is probably always false, given we're pegging the thread...
179+
if (token?.isCancellationRequested) { return []; }
151180
const line = lines[i];
152181

153182
const fileLine = FILE_LINE_REGEX.exec(line);
@@ -186,13 +215,14 @@ function parseSearchResults(document: vscode.TextDocument, token: vscode.Cancell
186215

187216
currentTargetLocations?.push(location);
188217

189-
links[i] = { type: 'result', location };
218+
links[i] = { type: 'result', location, isContext: seperator === ' ', prefixRange: new vscode.Range(i, 0, i, metadataOffset) };
190219
}
191220
}
192221

193222
cachedLastParse = {
194223
version: document.version,
195-
parse: links
224+
parse: links,
225+
uri: document.uri
196226
};
197227

198228
return links;

0 commit comments

Comments
 (0)