@vscode/sync-api-client
Advanced tools
Comparing version 0.2.0 to 0.2.1
import { URI } from 'vscode-uri'; | ||
import { BaseClientConnection, Requests, DTOs, ProcExitRequest } from '@vscode/sync-api-common'; | ||
import { ClientConnection, Requests, DTOs, ProcExitRequest } from '@vscode/sync-api-common'; | ||
import * as vscode from './vscode'; | ||
@@ -37,3 +37,3 @@ export interface Timer { | ||
export declare type APIRequests = Requests | ProcExitRequest; | ||
declare type ApiClientConnection = BaseClientConnection<APIRequests>; | ||
declare type ApiClientConnection = ClientConnection<APIRequests>; | ||
export declare class ApiClient { | ||
@@ -40,0 +40,0 @@ private readonly connection; |
@@ -70,12 +70,5 @@ "use strict"; | ||
constructor(connection) { | ||
// todo@dirkb this is temporary. We need to improve this by bundling the | ||
// Python lib into the worker code. | ||
this.statCache = new Map(); | ||
this.connection = connection; | ||
} | ||
stat(uri) { | ||
const cached = this.statCache.get(uri.toString()); | ||
if (cached !== undefined) { | ||
return cached; | ||
} | ||
const requestResult = this.connection.sendRequest('fileSystem/stat', { uri: uri.toJSON() }, sync_api_common_1.DTOs.Stat.typedResult); | ||
@@ -94,3 +87,2 @@ if (sync_api_common_1.RequestResult.hasData(requestResult)) { | ||
} | ||
this.statCache.set(uri.toString(), result); | ||
return result; | ||
@@ -97,0 +89,0 @@ } |
export * from '@vscode/sync-api-common'; | ||
export * from './apiClient'; | ||
export * from './vscode'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { URI } from 'vscode-uri'; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "@vscode/sync-api-client", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A client that calls VS Code API from a non extension host worker in sync fashion.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -8,3 +8,3 @@ /* -------------------------------------------------------------------------------------------- | ||
import { RAL, BaseClientConnection, Requests, RequestResult, DTOs, VariableResult, ProcExitRequest, RPCErrno, RPCError } from '@vscode/sync-api-common'; | ||
import { RAL, ClientConnection, Requests, RequestResult, DTOs, VariableResult, ProcExitRequest, RPCErrno, RPCError } from '@vscode/sync-api-common'; | ||
@@ -47,3 +47,3 @@ import * as vscode from './vscode'; | ||
export type APIRequests = Requests | ProcExitRequest; | ||
type ApiClientConnection = BaseClientConnection<APIRequests>; | ||
type ApiClientConnection = ClientConnection<APIRequests>; | ||
@@ -104,5 +104,2 @@ class TimerImpl implements Timer { | ||
private readonly connection: ApiClientConnection; | ||
// todo@dirkb this is temporary. We need to improve this by bundling the | ||
// Python lib into the worker code. | ||
private statCache: Map<string, vscode.FileStat> = new Map(); | ||
@@ -114,6 +111,2 @@ constructor(connection: ApiClientConnection) { | ||
public stat(uri: URI): vscode.FileStat { | ||
const cached = this.statCache.get(uri.toString()); | ||
if (cached !== undefined) { | ||
return cached; | ||
} | ||
const requestResult = this.connection.sendRequest('fileSystem/stat', { uri: uri.toJSON() }, DTOs.Stat.typedResult); | ||
@@ -132,3 +125,2 @@ if (RequestResult.hasData(requestResult)) { | ||
} | ||
this.statCache.set(uri.toString(), result); | ||
return result; | ||
@@ -135,0 +127,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59935
23
904