提交 0cd49204 编写于 作者: B Benjamin Pasero

recover from EditorGroup.isOpen({ resource }) change

上级 08551d7c
......@@ -243,8 +243,8 @@ export class ResourcesDropHandler {
droppedDirtyEditor.resource = this.textFileService.untitled.create({ mode: droppedDirtyEditor.mode, encoding: droppedDirtyEditor.encoding }).getResource();
}
// Return early if the resource is already dirty in target or opened already as file
if (this.textFileService.isDirty(droppedDirtyEditor.resource) || this.editorService.isOpen(this.editorService.createInput({ resource: droppedDirtyEditor.resource, forceFile: true }))) {
// File: ensure the file is not dirty or opened already
else if (this.textFileService.isDirty(droppedDirtyEditor.resource) || this.editorService.isOpen(this.editorService.createInput({ resource: droppedDirtyEditor.resource, forceFile: true }))) {
return false;
}
......
......@@ -25,6 +25,7 @@ import { timeout, RunOnceWorker } from 'vs/base/common/async';
import { withNullAsUndefined } from 'vs/base/common/types';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { isEqualOrParent, joinPath } from 'vs/base/common/resources';
import { Schemas } from 'vs/base/common/network';
export class FileEditorTracker extends Disposable implements IWorkbenchContribution {
......@@ -288,7 +289,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
return false; // resource must not be pending to save
}
if (this.editorService.isOpen(this.editorService.createInput({ resource, forceFile: true }))) {
if (this.editorService.isOpen(this.editorService.createInput({ resource, forceFile: resource.scheme !== Schemas.untitled, forceUntitled: resource.scheme === Schemas.untitled }))) {
return false; // model must not be opened already as file
}
......
......@@ -19,7 +19,6 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { deserializeSearchError, FileMatch, ICachedSearchStats, IFileMatch, IFileQuery, IFileSearchStats, IFolderQuery, IProgressMessage, ISearchComplete, ISearchEngineStats, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, ITextQuery, pathIncludedInQuery, QueryType, SearchError, SearchErrorCode, SearchProviderType, isFileMatch, isProgressMessage } from 'vs/workbench/services/search/common/search';
import { addContextToEditorMatches, editorMatchesToTextSearchResults } from 'vs/workbench/services/search/common/searchHelpers';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
export class SearchService extends Disposable implements ISearchService {
......@@ -32,7 +31,6 @@ export class SearchService extends Disposable implements ISearchService {
constructor(
private readonly modelService: IModelService,
private readonly textFileService: ITextFileService,
private readonly editorService: IEditorService,
private readonly telemetryService: ITelemetryService,
private readonly logService: ILogService,
......@@ -391,8 +389,8 @@ export class SearchService extends Disposable implements ISearchService {
return;
}
// Skip if editor is not opened as text file
if (this.editorService.isOpen(this.editorService.createInput({ resource, forceFile: true }))) {
// Skip files that are not opened as text file
if (!this.editorService.isOpen(this.editorService.createInput({ resource, forceFile: resource.scheme !== Schemas.untitled, forceUntitled: resource.scheme === Schemas.untitled }))) {
return;
}
......@@ -402,15 +400,8 @@ export class SearchService extends Disposable implements ISearchService {
return;
}
// Support untitled files
if (resource.scheme === Schemas.untitled) {
if (!this.textFileService.untitled.exists(resource)) {
return;
}
}
// Block walkthrough, webview, etc.
else if (!this.fileService.canHandleResource(resource)) {
if (resource.scheme !== Schemas.untitled && !this.fileService.canHandleResource(resource)) {
return;
}
......@@ -458,14 +449,13 @@ export class SearchService extends Disposable implements ISearchService {
export class RemoteSearchService extends SearchService {
constructor(
@IModelService modelService: IModelService,
@ITextFileService textFileService: ITextFileService,
@IEditorService editorService: IEditorService,
@ITelemetryService telemetryService: ITelemetryService,
@ILogService logService: ILogService,
@IExtensionService extensionService: IExtensionService,
@IFileService fileService: IFileService
) {
super(modelService, textFileService, editorService, telemetryService, logService, extensionService, fileService);
super(modelService, editorService, telemetryService, logService, extensionService, fileService);
}
}
......
......@@ -21,7 +21,6 @@ import { SearchChannelClient } from './searchIpc';
import { SearchService } from 'vs/workbench/services/search/common/searchService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
......@@ -31,7 +30,6 @@ import { parseSearchPort } from 'vs/platform/environment/node/environmentService
export class LocalSearchService extends SearchService {
constructor(
@IModelService modelService: IModelService,
@ITextFileService textFileService: ITextFileService,
@IEditorService editorService: IEditorService,
@ITelemetryService telemetryService: ITelemetryService,
@ILogService logService: ILogService,
......@@ -40,7 +38,7 @@ export class LocalSearchService extends SearchService {
@IWorkbenchEnvironmentService readonly environmentService: IWorkbenchEnvironmentService,
@IInstantiationService readonly instantiationService: IInstantiationService
) {
super(modelService, textFileService, editorService, telemetryService, logService, extensionService, fileService);
super(modelService, editorService, telemetryService, logService, extensionService, fileService);
this.diskSearch = instantiationService.createInstance(DiskSearch, !environmentService.isBuilt || environmentService.verbose, parseSearchPort(environmentService.args, environmentService.isBuilt));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册