Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)

* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79

* Fix breaks

* Extension management fixes

* Fix breaks in windows bundling

* Fix/skip failing tests

* Update distro

* Add clear to nuget.config

* Add hygiene task

* Bump distro

* Fix hygiene issue

* Add build to hygiene exclusion

* Update distro

* Update hygiene

* Hygiene exclusions

* Update tsconfig

* Bump distro for server breaks

* Update build config

* Update darwin path

* Add done calls to notebook tests

* Skip failing tests

* Disable smoke tests
This commit is contained in:
Karl Burtram
2021-02-09 16:15:05 -08:00
committed by GitHub
parent 6f192f9af5
commit ce612a3d96
1929 changed files with 68012 additions and 34564 deletions

View File

@@ -2,4 +2,4 @@
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
This extension provides Syntax Highlighting, Symbol Infomation, Result Highlighting, and Go to Definition capabilities for the Search Results Editor.
This extension provides Syntax Highlighting, Symbol Information, Result Highlighting, and Go to Definition capabilities for the Search Results Editor.

View File

@@ -3,6 +3,7 @@
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"enableProposedApi": true,
"publisher": "vscode",
"license": "MIT",
"engines": {

View File

@@ -8,7 +8,8 @@ import * as pathUtils from 'path';
const FILE_LINE_REGEX = /^(\S.*):$/;
const RESULT_LINE_REGEX = /^(\s+)(\d+)(:| )(\s+)(.*)$/;
const SEARCH_RESULT_SELECTOR = { language: 'search-result' };
const ELISION_REGEX = /⟪ ([0-9]+) characters skipped ⟫/g;
const SEARCH_RESULT_SELECTOR = { language: 'search-result', exclusive: true };
const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:'];
const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch'];
@@ -80,12 +81,18 @@ export function activate(context: vscode.ExtensionContext) {
return lineResult.allLocations;
}
const translateRangeSidewaysBy = (r: vscode.Range, n: number) =>
r.with({ start: new vscode.Position(r.start.line, Math.max(0, n - r.start.character)), end: new vscode.Position(r.end.line, Math.max(0, n - r.end.character)) });
const location = lineResult.locations.find(l => l.originSelectionRange.contains(position));
if (!location) {
return [];
}
const targetPos = new vscode.Position(
location.targetSelectionRange.start.line,
location.targetSelectionRange.start.character + (position.character - location.originSelectionRange.start.character)
);
return [{
...lineResult.location,
targetSelectionRange: translateRangeSidewaysBy(lineResult.location.targetSelectionRange!, position.character - 1)
...location,
targetSelectionRange: new vscode.Range(targetPos, targetPos),
}];
}
}),
@@ -93,7 +100,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.languages.registerDocumentLinkProvider(SEARCH_RESULT_SELECTOR, {
async provideDocumentLinks(document: vscode.TextDocument, token: vscode.CancellationToken): Promise<vscode.DocumentLink[]> {
return parseSearchResults(document, token)
.filter(({ type }) => type === 'file')
.filter(isFileLine)
.map(({ location }) => ({ range: location.originSelectionRange!, target: location.targetUri }));
}
}),
@@ -127,7 +134,7 @@ function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | u
}
const uriFromFolderWithPath = (folder: vscode.WorkspaceFolder, path: string): vscode.Uri =>
folder.uri.with({ path: pathUtils.join(folder.uri.fsPath, path) });
vscode.Uri.joinPath(folder.uri, path);
if (vscode.workspace.workspaceFolders) {
const multiRootFormattedPath = /^(.*) • (.*)$/.exec(path);
@@ -155,7 +162,7 @@ function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | u
}
type ParsedSearchFileLine = { type: 'file', location: vscode.LocationLink, allLocations: vscode.LocationLink[], path: string };
type ParsedSearchResultLine = { type: 'result', location: vscode.LocationLink, isContext: boolean, prefixRange: vscode.Range };
type ParsedSearchResultLine = { type: 'result', locations: Required<vscode.LocationLink>[], isContext: boolean, prefixRange: vscode.Range };
type ParsedSearchResults = Array<ParsedSearchFileLine | ParsedSearchResultLine>;
const isFileLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchFileLine => line.type === 'file';
const isResultLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchResultLine => line.type === 'result';
@@ -204,17 +211,35 @@ function parseSearchResults(document: vscode.TextDocument, token?: vscode.Cancel
const lineNumber = +_lineNumber - 1;
const resultStart = (indentation + _lineNumber + seperator + resultIndentation).length;
const metadataOffset = (indentation + _lineNumber + seperator).length;
const targetRange = new vscode.Range(Math.max(lineNumber - 3, 0), 0, lineNumber + 3, line.length);
const location: vscode.LocationLink = {
targetRange: new vscode.Range(Math.max(lineNumber - 3, 0), 0, lineNumber + 3, line.length),
targetSelectionRange: new vscode.Range(lineNumber, metadataOffset, lineNumber, metadataOffset),
targetUri: currentTarget,
originSelectionRange: new vscode.Range(i, resultStart, i, line.length),
};
let lastEnd = resultStart;
let offset = 0;
let locations: Required<vscode.LocationLink>[] = [];
ELISION_REGEX.lastIndex = resultStart;
for (let match: RegExpExecArray | null; (match = ELISION_REGEX.exec(line));) {
locations.push({
targetRange,
targetSelectionRange: new vscode.Range(lineNumber, offset, lineNumber, offset),
targetUri: currentTarget,
originSelectionRange: new vscode.Range(i, lastEnd, i, ELISION_REGEX.lastIndex - match[0].length),
});
currentTargetLocations?.push(location);
offset += (ELISION_REGEX.lastIndex - lastEnd - match[0].length) + Number(match[1]);
lastEnd = ELISION_REGEX.lastIndex;
}
links[i] = { type: 'result', location, isContext: seperator === ' ', prefixRange: new vscode.Range(i, 0, i, metadataOffset) };
if (lastEnd < line.length) {
locations.push({
targetRange,
targetSelectionRange: new vscode.Range(lineNumber, offset, lineNumber, offset),
targetUri: currentTarget,
originSelectionRange: new vscode.Range(i, lastEnd, i, line.length),
});
}
currentTargetLocations?.push(...locations);
links[i] = { type: 'result', locations, isContext: seperator === ' ', prefixRange: new vscode.Range(i, 0, i, metadataOffset) };
}
}

View File

@@ -83,6 +83,7 @@ const scopes = {
meta: 'meta.resultLine.search',
metaSingleLine: 'meta.resultLine.singleLine.search',
metaMultiLine: 'meta.resultLine.multiLine.search',
elision: 'comment meta.resultLine.elision',
prefix: {
meta: 'constant.numeric.integer meta.resultLinePrefix.search',
metaContext: 'meta.resultLinePrefix.contextLinePrefix.search',
@@ -220,6 +221,10 @@ const plainText = [
'4': { name: [scopes.resultBlock.result.prefix.meta, scopes.resultBlock.result.prefix.metaContext].join(' ') },
'5': { name: scopes.resultBlock.result.prefix.lineNumber },
}
},
{
match: '⟪ [0-9]+ characters skipped ⟫',
name: [scopes.resultBlock.meta, scopes.resultBlock.result.elision].join(' '),
}
];

View File

@@ -263,6 +263,10 @@
"name": "meta.resultLinePrefix.lineNumber.search"
}
}
},
{
"match": "⟪ [0-9]+ characters skipped ⟫",
"name": "meta.resultBlock.search comment meta.resultLine.elision"
}
],
"repository": {