mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
This commit is contained in:
@@ -156,7 +156,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(rpcProtocol, extHostDocumentsAndEditors));
|
||||
const extHostTreeViews = rpcProtocol.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(rpcProtocol.getProxy(MainContext.MainThreadTreeViews), extHostCommands, extHostLogService));
|
||||
const extHostEditorInsets = rpcProtocol.set(ExtHostContext.ExtHostEditorInsets, new ExtHostEditorInsets(rpcProtocol.getProxy(MainContext.MainThreadEditorInsets), extHostEditors, initData));
|
||||
const extHostDiagnostics = rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, new ExtHostDiagnostics(rpcProtocol, extHostLogService));
|
||||
const extHostDiagnostics = rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, new ExtHostDiagnostics(rpcProtocol, extHostLogService, extHostFileSystemInfo));
|
||||
const extHostLanguageFeatures = rpcProtocol.set(ExtHostContext.ExtHostLanguageFeatures, new ExtHostLanguageFeatures(rpcProtocol, uriTransformer, extHostDocuments, extHostCommands, extHostDiagnostics, extHostLogService, extHostApiDeprecation));
|
||||
const extHostFileSystem = rpcProtocol.set(ExtHostContext.ExtHostFileSystem, new ExtHostFileSystem(rpcProtocol, extHostLanguageFeatures));
|
||||
const extHostFileSystemEvent = rpcProtocol.set(ExtHostContext.ExtHostFileSystemEventService, new ExtHostFileSystemEventService(rpcProtocol, extHostLogService, extHostDocumentsAndEditors));
|
||||
|
||||
@@ -14,19 +14,24 @@ import { Event, Emitter, DebounceEmitter } from 'vs/base/common/event';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtHostFileSystemInfo } from 'vs/workbench/api/common/extHostFileSystemInfo';
|
||||
import { IExtUri } from 'vs/base/common/resources';
|
||||
|
||||
export class DiagnosticCollection implements vscode.DiagnosticCollection {
|
||||
|
||||
private readonly _data: ResourceMap<vscode.Diagnostic[]>;
|
||||
private _isDisposed = false;
|
||||
private _data = new ResourceMap<vscode.Diagnostic[]>();
|
||||
|
||||
constructor(
|
||||
private readonly _name: string,
|
||||
private readonly _owner: string,
|
||||
private readonly _maxDiagnosticsPerFile: number,
|
||||
extUri: IExtUri,
|
||||
private readonly _proxy: MainThreadDiagnosticsShape | undefined,
|
||||
private readonly _onDidChangeDiagnostics: Emitter<vscode.Uri[]>
|
||||
) { }
|
||||
) {
|
||||
this._data = new ResourceMap(uri => extUri.getComparisonKey(uri));
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
if (!this._isDisposed) {
|
||||
@@ -34,7 +39,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
|
||||
if (this._proxy) {
|
||||
this._proxy.$clear(this._owner);
|
||||
}
|
||||
this._data = undefined!;
|
||||
this._data.clear();
|
||||
this._isDisposed = true;
|
||||
}
|
||||
}
|
||||
@@ -227,13 +232,17 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
|
||||
readonly onDidChangeDiagnostics: Event<vscode.DiagnosticChangeEvent> = Event.map(this._onDidChangeDiagnostics.event, ExtHostDiagnostics._mapper);
|
||||
|
||||
constructor(mainContext: IMainContext, @ILogService private readonly _logService: ILogService) {
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
@ILogService private readonly _logService: ILogService,
|
||||
@IExtHostFileSystemInfo private readonly _fileSystemInfoService: IExtHostFileSystemInfo,
|
||||
) {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadDiagnostics);
|
||||
}
|
||||
|
||||
createDiagnosticCollection(extensionId: ExtensionIdentifier, name?: string): vscode.DiagnosticCollection {
|
||||
|
||||
const { _collections, _proxy, _onDidChangeDiagnostics, _logService } = this;
|
||||
const { _collections, _proxy, _onDidChangeDiagnostics, _logService, _fileSystemInfoService } = this;
|
||||
|
||||
const loggingProxy = new class implements MainThreadDiagnosticsShape {
|
||||
$changeMany(owner: string, entries: [UriComponents, IMarkerData[] | undefined][]): void {
|
||||
@@ -265,7 +274,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
|
||||
const result = new class extends DiagnosticCollection {
|
||||
constructor() {
|
||||
super(name!, owner, ExtHostDiagnostics._maxDiagnosticsPerFile, loggingProxy, _onDidChangeDiagnostics);
|
||||
super(name!, owner, ExtHostDiagnostics._maxDiagnosticsPerFile, _fileSystemInfoService.extUri, loggingProxy, _onDidChangeDiagnostics);
|
||||
_collections.set(owner, this);
|
||||
}
|
||||
override dispose() {
|
||||
@@ -317,7 +326,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
|
||||
if (!this._mirrorCollection) {
|
||||
const name = '_generated_mirror';
|
||||
const collection = new DiagnosticCollection(name, name, ExtHostDiagnostics._maxDiagnosticsPerFile, undefined, this._onDidChangeDiagnostics);
|
||||
const collection = new DiagnosticCollection(name, name, ExtHostDiagnostics._maxDiagnosticsPerFile, this._fileSystemInfoService.extUri, undefined, this._onDidChangeDiagnostics);
|
||||
this._collections.set(name, collection);
|
||||
this._mirrorCollection = collection;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ExtUri, IExtUri } from 'vs/base/common/resources';
|
||||
import { FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ExtHostFileSystemInfoShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
|
||||
@@ -14,6 +16,23 @@ export class ExtHostFileSystemInfo implements ExtHostFileSystemInfoShape {
|
||||
private readonly _systemSchemes = new Set(Object.keys(Schemas));
|
||||
private readonly _providerInfo = new Map<string, number>();
|
||||
|
||||
readonly extUri: IExtUri;
|
||||
|
||||
constructor() {
|
||||
this.extUri = new ExtUri(uri => {
|
||||
const capabilities = this._providerInfo.get(uri.scheme);
|
||||
if (capabilities === undefined) {
|
||||
// default: not ignore
|
||||
return false;
|
||||
}
|
||||
if (capabilities & FileSystemProviderCapabilities.PathCaseSensitive) {
|
||||
// configured as case sensitive
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
$acceptProviderInfos(scheme: string, capabilities: number | null): void {
|
||||
if (capabilities === null) {
|
||||
this._providerInfo.delete(scheme);
|
||||
@@ -31,5 +50,7 @@ export class ExtHostFileSystemInfo implements ExtHostFileSystemInfoShape {
|
||||
}
|
||||
}
|
||||
|
||||
export interface IExtHostFileSystemInfo extends ExtHostFileSystemInfo { }
|
||||
export interface IExtHostFileSystemInfo extends ExtHostFileSystemInfo {
|
||||
readonly extUri: IExtUri;
|
||||
}
|
||||
export const IExtHostFileSystemInfo = createDecorator<IExtHostFileSystemInfo>('IExtHostFileSystemInfo');
|
||||
|
||||
Reference in New Issue
Block a user