-
Notifications
You must be signed in to change notification settings - Fork 29k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#47058 - Search provider running in EH with switch to enable
- Loading branch information
1 parent
33a00fd
commit 2d08462
Showing
18 changed files
with
2,406 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/** | ||
src/** | ||
test/** | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "search-rg", | ||
"description": "%description%", | ||
"displayName": "%displayName%", | ||
"version": "1.0.0", | ||
"icon": "icon.png", | ||
"author": "vscode", | ||
"publisher": "vscode", | ||
"license": "MIT", | ||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", | ||
"enableProposedApi": true, | ||
"engines": { | ||
"vscode": "*" | ||
}, | ||
"categories": [], | ||
"dependencies": { | ||
"vscode-extension-telemetry": "0.0.15", | ||
"vscode-nls": "^3.2.1", | ||
"vscode-ripgrep": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "8.0.33", | ||
"@types/semver": "5.4.0", | ||
"vscode": "^1.1.17" | ||
}, | ||
"scripts": {}, | ||
"activationEvents": [ | ||
"*" | ||
], | ||
"main": "./out/extension", | ||
"contributes": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"displayName": "Search", | ||
"description": "Provides search." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as vscode from 'vscode'; | ||
import { RipgrepTextSearchEngine } from './ripgrepTextSearch'; | ||
|
||
export function activate(): void { | ||
const provider = new RipgrepSearchProvider(); | ||
vscode.workspace.registerSearchProvider('file', provider); | ||
} | ||
|
||
class RipgrepSearchProvider implements vscode.SearchProvider { | ||
provideTextSearchResults(query: vscode.TextSearchQuery, options: vscode.TextSearchOptions, progress: vscode.Progress<vscode.TextSearchResult>, token: vscode.CancellationToken): Thenable<void> { | ||
const engine = new RipgrepTextSearchEngine(); | ||
return engine.provideTextSearchResults(query, options, progress, token); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
'use strict'; | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
import * as path from 'path'; | ||
|
||
export function patternsToRgGlobs(patterns: vscode.GlobPattern[]): string[] { | ||
return patterns.map(p => { | ||
if (typeof p === 'string') { | ||
return p; | ||
} else { | ||
// TODO | ||
return p.pattern; | ||
} | ||
}); | ||
} | ||
|
||
export function fixDriveC(_path: string): string { | ||
const root = path.parse(_path).root; | ||
return root.toLowerCase() === 'c:/' ? | ||
_path.replace(/^c:[/\\]/i, '/') : | ||
_path; | ||
} | ||
|
||
function trimTrailingSlash(str: string): string { | ||
return str | ||
.replace(/\/$/, '') | ||
.replace(/\\$/, ''); | ||
} |
Oops, something went wrong.