Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbea36b

Browse files
ssigwartJackson Kearl
and
Jackson Kearl
authored
Search editor go to location improvements (#135227)
* Search editor go to location improvements- Added option to go to and select the match- Fixed cursor placement with initial whitespace* Remove#128927 changes* Fix up seprartor logicCo-authored-by: Jackson Kearl <jakearl@microsoft.com>
1 parentf6a5fbe commitdbea36b

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

‎extensions/search-result/src/extension.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as vscode from 'vscode';
77
import*aspathUtilsfrom'path';
88

99
constFILE_LINE_REGEX=/^(\S.*):$/;
10-
constRESULT_LINE_REGEX=/^(\s+)(\d+)(:|)(\s+)(.*)$/;
10+
constRESULT_LINE_REGEX=/^(\s+)(\d+)(:|)(\s*)(.*)$/;
1111
constELISION_REGEX=/([0-9]+)charactersskipped/g;
1212
constSEARCH_RESULT_SELECTOR={language:'search-result',exclusive:true};
1313
constDIRECTIVES=['# Query:','# Flags:','# Including:','# Excluding:','# ContextLines:'];
@@ -220,10 +220,9 @@ function parseSearchResults(document: vscode.TextDocument, token?: vscode.Cancel
220220

221221
constresultLine=RESULT_LINE_REGEX.exec(line);
222222
if(resultLine){
223-
const[,indentation,_lineNumber,seperator,resultIndentation]=resultLine;
223+
const[,indentation,_lineNumber,separator]=resultLine;
224224
constlineNumber=+_lineNumber-1;
225-
constresultStart=(indentation+_lineNumber+seperator+resultIndentation).length;
226-
constmetadataOffset=(indentation+_lineNumber+seperator).length;
225+
constmetadataOffset=(indentation+_lineNumber+separator).length;
227226
consttargetRange=newvscode.Range(Math.max(lineNumber-3,0),0,lineNumber+3,line.length);
228227

229228
letlocations:Required<vscode.LocationLink>[]=[];
@@ -233,12 +232,12 @@ function parseSearchResults(document: vscode.TextDocument, token?: vscode.Cancel
233232
targetRange,
234233
targetSelectionRange:newvscode.Range(lineNumber,0,lineNumber,1),
235234
targetUri:currentTarget,
236-
originSelectionRange:newvscode.Range(i,0,i,resultStart),
235+
originSelectionRange:newvscode.Range(i,0,i,metadataOffset-1),
237236
});
238237

239-
letlastEnd=resultStart;
238+
letlastEnd=metadataOffset;
240239
letoffset=0;
241-
ELISION_REGEX.lastIndex=resultStart;
240+
ELISION_REGEX.lastIndex=metadataOffset;
242241
for(letmatch:RegExpExecArray|null;(match=ELISION_REGEX.exec(line));){
243242
locations.push({
244243
targetRange,
@@ -261,7 +260,7 @@ function parseSearchResults(document: vscode.TextDocument, token?: vscode.Cancel
261260
}
262261

263262
currentTargetLocations?.push(...locations);
264-
links[i]={type:'result', locations,isContext:seperator===' ',prefixRange:newvscode.Range(i,0,i,metadataOffset)};
263+
links[i]={type:'result', locations,isContext:separator===' ',prefixRange:newvscode.Range(i,0,i,metadataOffset)};
265264
}
266265
}
267266

‎src/vs/workbench/contrib/searchEditor/browser/searchEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { renderSearchMessage } from 'vs/workbench/contrib/search/browser/searchM
6262
import{EditorExtensionsRegistry,IEditorContributionDescription}from'vs/editor/browser/editorExtensions';
6363
import{UnusualLineTerminatorsDetector}from'vs/editor/contrib/unusualLineTerminators/unusualLineTerminators';
6464

65-
constRESULT_LINE_REGEX=/^(\s+)(\d+)(:|)(\s+)(.*)$/;
65+
constRESULT_LINE_REGEX=/^(\s+)(\d+)(:|)(\s*)(.*)$/;
6666
constFILE_LINE_REGEX=/^(\S.*):$/;
6767

6868
typeSearchEditorViewState=ICodeEditorViewState&{focused:'input'|'editor'};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp