@vscode/sync-api-client
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,0 +0,0 @@ { |
@@ -12,4 +12,4 @@ import { URI } from 'vscode-uri'; | ||
stat(uri: URI): vscode.FileStat; | ||
read(uri: URI): Uint8Array; | ||
write(uri: URI, content: Uint8Array): void; | ||
readFile(uri: URI): Uint8Array; | ||
writeFile(uri: URI, content: Uint8Array): void; | ||
readDirectory(uri: URI): DTOs.DirectoryEntries; | ||
@@ -16,0 +16,0 @@ createDirectory(uri: URI): void; |
@@ -6,2 +6,25 @@ "use strict"; | ||
* ------------------------------------------------------------------------------------------ */ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -11,3 +34,3 @@ exports.ApiClient = void 0; | ||
const sync_api_common_1 = require("@vscode/sync-api-common"); | ||
const vscode = require("./vscode"); | ||
const vscode = __importStar(require("./vscode")); | ||
class TimerImpl { | ||
@@ -77,3 +100,3 @@ constructor(connection) { | ||
} | ||
read(uri) { | ||
readFile(uri) { | ||
const requestResult = this.connection.sendRequest('fileSystem/readFile', { uri: uri.toJSON() }, new sync_api_common_1.VariableResult('binary')); | ||
@@ -85,3 +108,3 @@ if (sync_api_common_1.RequestResult.hasData(requestResult)) { | ||
} | ||
write(uri, content) { | ||
writeFile(uri, content) { | ||
const requestResult = this.connection.sendRequest('fileSystem/writeFile', { uri: uri.toJSON(), binary: content }); | ||
@@ -166,3 +189,3 @@ if (requestResult.errno !== sync_api_common_1.RPCErrno.Success) { | ||
this.connection = connection; | ||
this.encoder = (0, sync_api_common_1.default)().TextEncoder.create(); | ||
this.encoder = (0, sync_api_common_1.RAL)().TextEncoder.create(); | ||
this.timer = new TimerImpl(this.connection); | ||
@@ -169,0 +192,0 @@ this.process = new ProcessImpl(this.connection); |
{ | ||
"name": "@vscode/sync-api-client", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A client that calls VS Code API from a non extension host worker in sync fashion.", | ||
@@ -27,3 +27,3 @@ "engines": { | ||
"vscode-uri": "3.0.3", | ||
"@vscode/sync-api-common": "0.1.0" | ||
"@vscode/sync-api-common": "0.2.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
@@ -42,5 +42,5 @@ # VSCode Sync API Client | ||
// Read a file for a given uri | ||
const content = apiClient.vscode.workspace.filesystem.read(uri); | ||
const content = apiClient.vscode.workspace.filesystem.readFile(uri); | ||
``` | ||
For code executed in the browser exchange the import `@vscode/sync-api-common/node` with `@vscode/sync-api-common/browser`. |
@@ -8,3 +8,3 @@ /* -------------------------------------------------------------------------------------------- | ||
import RAL, { BaseClientConnection, Requests, RequestResult, DTOs, VariableResult, ProcExitRequest, RPCErrno, RPCError } from '@vscode/sync-api-common'; | ||
import { RAL, BaseClientConnection, Requests, RequestResult, DTOs, VariableResult, ProcExitRequest, RPCErrno, RPCError } from '@vscode/sync-api-common'; | ||
@@ -23,4 +23,4 @@ import * as vscode from './vscode'; | ||
stat(uri: URI): vscode.FileStat; | ||
read(uri: URI): Uint8Array; | ||
write(uri: URI, content: Uint8Array): void; | ||
readFile(uri: URI): Uint8Array; | ||
writeFile(uri: URI, content: Uint8Array): void; | ||
readDirectory(uri: URI): DTOs.DirectoryEntries; | ||
@@ -136,3 +136,3 @@ createDirectory(uri: URI): void; | ||
public read(uri: URI): Uint8Array { | ||
public readFile(uri: URI): Uint8Array { | ||
const requestResult = this.connection.sendRequest('fileSystem/readFile', { uri: uri.toJSON() }, new VariableResult<Uint8Array>('binary')); | ||
@@ -145,3 +145,3 @@ if (RequestResult.hasData(requestResult)) { | ||
public write(uri: URI, content: Uint8Array): void { | ||
public writeFile(uri: URI, content: Uint8Array): void { | ||
const requestResult = this.connection.sendRequest('fileSystem/writeFile', { uri: uri.toJSON(), binary: content }); | ||
@@ -148,0 +148,0 @@ if (requestResult.errno !== RPCErrno.Success) { |
@@ -11,5 +11,5 @@ { | ||
"lib": [ "es2020" ], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"module": "Node16", | ||
"moduleResolution": "Node16", | ||
} | ||
} |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
71088
24
920
+ Added@vscode/sync-api-common@0.2.0(transitive)
- Removed@vscode/sync-api-common@0.1.0(transitive)