mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 17:19:01 +01:00
Extract out toKey function
This commit is contained in:
@@ -105,24 +105,24 @@ class SyncedBufferMap {
|
||||
) { }
|
||||
|
||||
public has(resource: Uri): boolean {
|
||||
const file = this._normalizePath(resource);
|
||||
const file = this.toKey(resource);
|
||||
return !!file && this._map.has(file);
|
||||
}
|
||||
|
||||
public get(resource: Uri): SyncedBuffer | undefined {
|
||||
const file = this._normalizePath(resource);
|
||||
const file = this.toKey(resource);
|
||||
return file ? this._map.get(file) : undefined;
|
||||
}
|
||||
|
||||
public set(resource: Uri, buffer: SyncedBuffer) {
|
||||
const file = this._normalizePath(resource);
|
||||
const file = this.toKey(resource);
|
||||
if (file) {
|
||||
this._map.set(file, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public delete(resource: Uri): void {
|
||||
const file = this._normalizePath(resource);
|
||||
const file = this.toKey(resource);
|
||||
if (file) {
|
||||
this._map.delete(file);
|
||||
}
|
||||
@@ -135,13 +135,13 @@ class SyncedBufferMap {
|
||||
public get allResources(): Iterable<string> {
|
||||
return this._map.keys();
|
||||
}
|
||||
|
||||
private toKey(resource: Uri): string | null {
|
||||
return this._normalizePath(resource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export interface Diagnostics {
|
||||
delete(resource: Uri): void;
|
||||
}
|
||||
|
||||
export default class BufferSyncSupport {
|
||||
|
||||
private readonly client: ITypeScriptServiceClient;
|
||||
|
||||
Reference in New Issue
Block a user