mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Merge branch 'master' into ben/editor
This commit is contained in:
@@ -568,7 +568,10 @@ export function createApiFactory(
|
||||
}),
|
||||
registerSearchProvider: proposedApiFunction(extension, (scheme, provider) => {
|
||||
return extHostSearch.registerSearchProvider(scheme, provider);
|
||||
})
|
||||
}),
|
||||
onDidRenameResource: proposedApiFunction(extension, (listener, thisArg?, disposables?) => {
|
||||
return extHostDocuments.onDidRenameResource(listener, thisArg, disposables);
|
||||
}),
|
||||
};
|
||||
|
||||
// namespace: scm
|
||||
@@ -669,6 +672,7 @@ export function createApiFactory(
|
||||
Color: extHostTypes.Color,
|
||||
ColorPresentation: extHostTypes.ColorPresentation,
|
||||
ColorInformation: extHostTypes.ColorInformation,
|
||||
CodeActionTrigger: extHostTypes.CodeActionTrigger,
|
||||
EndOfLine: extHostTypes.EndOfLine,
|
||||
CompletionItem: extHostTypes.CompletionItem,
|
||||
CompletionItemKind: extHostTypes.CompletionItemKind,
|
||||
|
||||
@@ -530,6 +530,7 @@ export interface ExtHostDocumentsShape {
|
||||
$acceptModelSaved(strURL: UriComponents): void;
|
||||
$acceptDirtyStateChanged(strURL: UriComponents, isDirty: boolean): void;
|
||||
$acceptModelChanged(strURL: UriComponents, e: IModelChangedEvent, isDirty: boolean): void;
|
||||
$onDidRename(oldURL: UriComponents, newURL: UriComponents): void;
|
||||
}
|
||||
|
||||
export interface ExtHostDocumentSaveParticipantShape {
|
||||
|
||||
@@ -21,11 +21,13 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
private _onDidRemoveDocument = new Emitter<vscode.TextDocument>();
|
||||
private _onDidChangeDocument = new Emitter<vscode.TextDocumentChangeEvent>();
|
||||
private _onDidSaveDocument = new Emitter<vscode.TextDocument>();
|
||||
private _onDidRenameResource = new Emitter<vscode.ResourceRenamedEvent>();
|
||||
|
||||
readonly onDidAddDocument: Event<vscode.TextDocument> = this._onDidAddDocument.event;
|
||||
readonly onDidRemoveDocument: Event<vscode.TextDocument> = this._onDidRemoveDocument.event;
|
||||
readonly onDidChangeDocument: Event<vscode.TextDocumentChangeEvent> = this._onDidChangeDocument.event;
|
||||
readonly onDidSaveDocument: Event<vscode.TextDocument> = this._onDidSaveDocument.event;
|
||||
readonly onDidRenameResource: Event<vscode.ResourceRenamedEvent> = this._onDidRenameResource.event;
|
||||
|
||||
private _toDispose: IDisposable[];
|
||||
private _proxy: MainThreadDocumentsShape;
|
||||
@@ -148,4 +150,11 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
public setWordDefinitionFor(modeId: string, wordDefinition: RegExp): void {
|
||||
setWordDefinitionFor(modeId, wordDefinition);
|
||||
}
|
||||
|
||||
public $onDidRename(oldURL: UriComponents, newURL: UriComponents): void {
|
||||
const oldResource = URI.revive(oldURL);
|
||||
const newResource = URI.revive(newURL);
|
||||
this._onDidRenameResource.fire({ oldResource, newResource });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,17 +88,12 @@ class CodeLensAdapter {
|
||||
|
||||
private static _badCmd: vscode.Command = { command: 'missing', title: '<<MISSING COMMAND>>' };
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _commands: CommandsConverter;
|
||||
private _heapService: ExtHostHeapService;
|
||||
private _provider: vscode.CodeLensProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, commands: CommandsConverter, heapService: ExtHostHeapService, provider: vscode.CodeLensProvider) {
|
||||
this._documents = documents;
|
||||
this._commands = commands;
|
||||
this._heapService = heapService;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _commands: CommandsConverter,
|
||||
private readonly _heapService: ExtHostHeapService,
|
||||
private readonly _provider: vscode.CodeLensProvider
|
||||
) { }
|
||||
|
||||
provideCodeLenses(resource: URI): TPromise<modes.ICodeLensSymbol[]> {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
@@ -140,13 +135,11 @@ class CodeLensAdapter {
|
||||
}
|
||||
|
||||
class DefinitionAdapter {
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.DefinitionProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.DefinitionProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.DefinitionProvider
|
||||
) { }
|
||||
|
||||
provideDefinition(resource: URI, position: IPosition): TPromise<modes.Definition> {
|
||||
let doc = this._documents.getDocumentData(resource).document;
|
||||
@@ -163,13 +156,11 @@ class DefinitionAdapter {
|
||||
}
|
||||
|
||||
class ImplementationAdapter {
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.ImplementationProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.ImplementationProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.ImplementationProvider
|
||||
) { }
|
||||
|
||||
provideImplementation(resource: URI, position: IPosition): TPromise<modes.Definition> {
|
||||
let doc = this._documents.getDocumentData(resource).document;
|
||||
@@ -186,13 +177,11 @@ class ImplementationAdapter {
|
||||
}
|
||||
|
||||
class TypeDefinitionAdapter {
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.TypeDefinitionProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.TypeDefinitionProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.TypeDefinitionProvider
|
||||
) { }
|
||||
|
||||
provideTypeDefinition(resource: URI, position: IPosition): TPromise<modes.Definition> {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
@@ -208,15 +197,12 @@ class TypeDefinitionAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HoverAdapter {
|
||||
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.HoverProvider,
|
||||
) {
|
||||
//
|
||||
}
|
||||
) { }
|
||||
|
||||
public provideHover(resource: URI, position: IPosition): TPromise<modes.Hover> {
|
||||
|
||||
@@ -241,13 +227,10 @@ class HoverAdapter {
|
||||
|
||||
class DocumentHighlightAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.DocumentHighlightProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.DocumentHighlightProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.DocumentHighlightProvider
|
||||
) { }
|
||||
|
||||
provideDocumentHighlights(resource: URI, position: IPosition): TPromise<modes.DocumentHighlight[]> {
|
||||
|
||||
@@ -265,13 +248,10 @@ class DocumentHighlightAdapter {
|
||||
|
||||
class ReferenceAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.ReferenceProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.ReferenceProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.ReferenceProvider
|
||||
) { }
|
||||
|
||||
provideReferences(resource: URI, position: IPosition, context: modes.ReferenceContext): TPromise<modes.Location[]> {
|
||||
let doc = this._documents.getDocumentData(resource).document;
|
||||
@@ -315,7 +295,8 @@ class CodeActionAdapter {
|
||||
|
||||
const codeActionContext: vscode.CodeActionContext = {
|
||||
diagnostics: allDiagnostics,
|
||||
only: context.only ? new CodeActionKind(context.only) : undefined
|
||||
only: context.only ? new CodeActionKind(context.only) : undefined,
|
||||
triggerKind: context.trigger,
|
||||
};
|
||||
|
||||
return asWinJsPromise(token =>
|
||||
@@ -359,13 +340,10 @@ class CodeActionAdapter {
|
||||
|
||||
class DocumentFormattingAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.DocumentFormattingEditProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.DocumentFormattingEditProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.DocumentFormattingEditProvider
|
||||
) { }
|
||||
|
||||
provideDocumentFormattingEdits(resource: URI, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
|
||||
|
||||
@@ -382,13 +360,10 @@ class DocumentFormattingAdapter {
|
||||
|
||||
class RangeFormattingAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.DocumentRangeFormattingEditProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.DocumentRangeFormattingEditProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.DocumentRangeFormattingEditProvider
|
||||
) { }
|
||||
|
||||
provideDocumentRangeFormattingEdits(resource: URI, range: IRange, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
|
||||
|
||||
@@ -406,13 +381,10 @@ class RangeFormattingAdapter {
|
||||
|
||||
class OnTypeFormattingAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.OnTypeFormattingEditProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.OnTypeFormattingEditProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.OnTypeFormattingEditProvider
|
||||
) { }
|
||||
|
||||
autoFormatTriggerCharacters: string[] = []; // not here
|
||||
|
||||
@@ -498,13 +470,10 @@ class RenameAdapter {
|
||||
return typeof provider.prepareRename === 'function';
|
||||
}
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.RenameProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.RenameProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.RenameProvider
|
||||
) { }
|
||||
|
||||
provideRenameEdits(resource: URI, position: IPosition, newName: string): TPromise<modes.WorkspaceEdit> {
|
||||
|
||||
@@ -733,13 +702,10 @@ class SuggestAdapter {
|
||||
|
||||
class SignatureHelpAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _provider: vscode.SignatureHelpProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, provider: vscode.SignatureHelpProvider) {
|
||||
this._documents = documents;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _provider: vscode.SignatureHelpProvider
|
||||
) { }
|
||||
|
||||
provideSignatureHelp(resource: URI, position: IPosition): TPromise<modes.SignatureHelp> {
|
||||
|
||||
@@ -757,15 +723,11 @@ class SignatureHelpAdapter {
|
||||
|
||||
class LinkProviderAdapter {
|
||||
|
||||
private _documents: ExtHostDocuments;
|
||||
private _heapService: ExtHostHeapService;
|
||||
private _provider: vscode.DocumentLinkProvider;
|
||||
|
||||
constructor(documents: ExtHostDocuments, heapService: ExtHostHeapService, provider: vscode.DocumentLinkProvider) {
|
||||
this._documents = documents;
|
||||
this._heapService = heapService;
|
||||
this._provider = provider;
|
||||
}
|
||||
constructor(
|
||||
private readonly _documents: ExtHostDocuments,
|
||||
private readonly _heapService: ExtHostHeapService,
|
||||
private readonly _provider: vscode.DocumentLinkProvider
|
||||
) { }
|
||||
|
||||
provideLinks(resource: URI): TPromise<modes.ILink[]> {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
|
||||
@@ -14,7 +14,7 @@ import * as strings from 'vs/base/common/strings';
|
||||
import URI, { UriComponents } from 'vs/base/common/uri';
|
||||
import { PPromise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IItemAccessor, ScorerCache, compareItemsByScore, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
import { ICachedSearchStats, IRawFileMatch2, IFolderQuery, IPatternInfo, IRawSearchQuery, ISearchQuery, ISearchCompleteStats, IFileMatch } from 'vs/platform/search/common/search';
|
||||
import { ICachedSearchStats, IFileMatch, IFolderQuery, IPatternInfo, IRawSearchQuery, ISearchQuery, ISearchCompleteStats, IRawFileMatch2 } from 'vs/platform/search/common/search';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtHostSearchShape, IMainContext, MainContext, MainThreadSearchShape } from './extHost.protocol';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
@@ -133,9 +133,11 @@ function reviveFolderQuery(rawFolderQuery: IFolderQuery<UriComponents>): IFolder
|
||||
class TextSearchResultsCollector {
|
||||
private _batchedCollector: BatchedCollector<IRawFileMatch2>;
|
||||
|
||||
private _currentFolderIdx: number;
|
||||
private _currentRelativePath: string;
|
||||
private _currentFileMatch: IRawFileMatch2;
|
||||
|
||||
constructor(private _onResult: (result: IRawFileMatch2[]) => void) {
|
||||
constructor(private folderQueries: IFolderQuery[], private _onResult: (result: IRawFileMatch2[]) => void) {
|
||||
this._batchedCollector = new BatchedCollector<IRawFileMatch2>(512, items => this.sendItems(items));
|
||||
}
|
||||
|
||||
@@ -143,17 +145,15 @@ class TextSearchResultsCollector {
|
||||
// Collects TextSearchResults into IInternalFileMatches and collates using BatchedCollector.
|
||||
// This is efficient for ripgrep which sends results back one file at a time. It wouldn't be efficient for other search
|
||||
// providers that send results in random order. We could do this step afterwards instead.
|
||||
if (this._currentFileMatch && (this._currentFileMatch.resource.folderIdx !== folderIdx || this._currentFileMatch.resource.relativePath !== data.path)) {
|
||||
if (this._currentFileMatch && (this._currentFolderIdx !== folderIdx || this._currentRelativePath !== data.path)) {
|
||||
this.pushToCollector();
|
||||
this._currentFileMatch = null;
|
||||
}
|
||||
|
||||
if (!this._currentFileMatch) {
|
||||
const resource = URI.file(path.join(this.folderQueries[folderIdx].folder.fsPath, data.path));
|
||||
this._currentFileMatch = {
|
||||
resource: {
|
||||
folderIdx,
|
||||
relativePath: data.path
|
||||
},
|
||||
resource,
|
||||
lineMatches: []
|
||||
};
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class QueryGlobTester {
|
||||
}
|
||||
|
||||
return this._parsedIncludeExpression ?
|
||||
TPromise.as(this._parsedIncludeExpression(testPath, basename, siblingsFn)).then(result => !result) :
|
||||
TPromise.as(this._parsedIncludeExpression(testPath, basename, siblingsFn)).then(result => !!result) :
|
||||
TPromise.wrap(true);
|
||||
}).then(included => {
|
||||
return included;
|
||||
@@ -393,7 +393,7 @@ class TextSearchEngine {
|
||||
const folderQueries = this.config.folderQueries;
|
||||
|
||||
return new PPromise<{ limitHit: boolean }, IRawFileMatch2[]>((resolve, reject, _onResult) => {
|
||||
this.collector = new TextSearchResultsCollector(_onResult);
|
||||
this.collector = new TextSearchResultsCollector(this.config.folderQueries, _onResult);
|
||||
|
||||
const onResult = (match: vscode.TextSearchResult, folderIdx: number) => {
|
||||
if (this.isCanceled) {
|
||||
|
||||
@@ -903,6 +903,11 @@ export class Hierarchy<T> {
|
||||
}
|
||||
}
|
||||
|
||||
export enum CodeActionTrigger {
|
||||
Automatic = 1,
|
||||
Manual = 2,
|
||||
}
|
||||
|
||||
export class CodeAction {
|
||||
title: string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user