@onflow/cadence-language-server
Advanced tools
Comparing version 0.33.2 to 0.33.3
@@ -7,3 +7,3 @@ export const go: Go; | ||
_exitPromise: Promise<any>; | ||
_resolveExitPromise: (value?: any) => void; | ||
_resolveExitPromise: (value: any) => void; | ||
_pendingEvent: any; | ||
@@ -45,3 +45,3 @@ _scheduledTimeouts: Map<any, any>; | ||
_inst: WebAssembly.Instance | undefined; | ||
_values: (number | boolean | (NodeJS.Global & typeof globalThis) | Go | null)[] | undefined; | ||
_values: any; | ||
_goRefCounts: any[] | undefined; | ||
@@ -48,0 +48,0 @@ _ids: any; |
@@ -1,5 +0,6 @@ | ||
import { Message } from "vscode-jsonrpc/lib/messages"; | ||
import { Message } from "vscode-jsonrpc"; | ||
export interface Callbacks { | ||
toClient?(message: Message): void; | ||
getAddressCode?(address: string): string | undefined; | ||
getStringCode?(location: string): string | undefined; | ||
toServer?(error: any, message: Message): void; | ||
@@ -6,0 +7,0 @@ onClientClose?(): void; |
@@ -30,2 +30,38 @@ /* | ||
export class CadenceLanguageServer { | ||
static functionName(name) { | ||
return `__${CadenceLanguageServer.functionNamePrefix}_${name}__`; | ||
} | ||
functionName(name) { | ||
return `__${CadenceLanguageServer.functionNamePrefix}_${this.id}_${name}__`; | ||
} | ||
static create(binaryLocation, callbacks) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.ensureLoaded(binaryLocation); | ||
return new CadenceLanguageServer(callbacks); | ||
}); | ||
} | ||
static ensureLoaded(urlOrBinary) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.loaded) { | ||
return; | ||
} | ||
this.setWriteSync(); | ||
yield this.load(urlOrBinary); | ||
this.loaded = true; | ||
}); | ||
} | ||
static load(urlOrBinary) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let instantiatedSource; | ||
if (typeof urlOrBinary === 'string') { | ||
const binaryRequest = fetch(urlOrBinary); | ||
instantiatedSource = yield WebAssembly.instantiateStreaming(binaryRequest, go.importObject); | ||
} | ||
else { | ||
instantiatedSource = yield WebAssembly.instantiate(urlOrBinary, go.importObject); | ||
} | ||
// NOTE: don't await the promise, just ignore it, as it is only resolved when the program exists | ||
go.run(instantiatedSource.instance).then(() => { }); | ||
}); | ||
} | ||
constructor(callbacks) { | ||
@@ -50,2 +86,8 @@ this.isClientClosed = false; | ||
}; | ||
env[this.functionName('getStringCode')] = (location) => { | ||
if (!callbacks.getStringCode) { | ||
return undefined; | ||
} | ||
return callbacks.getStringCode(location); | ||
}; | ||
env[this.functionName('onServerClose')] = () => { | ||
@@ -68,38 +110,2 @@ if (!callbacks.onServerClose) { | ||
} | ||
static functionName(name) { | ||
return `__${CadenceLanguageServer.functionNamePrefix}_${name}__`; | ||
} | ||
functionName(name) { | ||
return `__${CadenceLanguageServer.functionNamePrefix}_${this.id}_${name}__`; | ||
} | ||
static create(binaryLocation, callbacks) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.ensureLoaded(binaryLocation); | ||
return new CadenceLanguageServer(callbacks); | ||
}); | ||
} | ||
static ensureLoaded(urlOrBinary) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.loaded) { | ||
return; | ||
} | ||
this.setWriteSync(); | ||
yield this.load(urlOrBinary); | ||
this.loaded = true; | ||
}); | ||
} | ||
static load(urlOrBinary) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let instantiatedSource; | ||
if (typeof urlOrBinary === 'string') { | ||
const binaryRequest = fetch(urlOrBinary); | ||
instantiatedSource = yield WebAssembly.instantiateStreaming(binaryRequest, go.importObject); | ||
} | ||
else { | ||
instantiatedSource = yield WebAssembly.instantiate(urlOrBinary, go.importObject); | ||
} | ||
// NOTE: don't await the promise, just ignore it, as it is only resolved when the program exists | ||
go.run(instantiatedSource.instance).then(() => { }); | ||
}); | ||
} | ||
close() { | ||
@@ -106,0 +112,0 @@ const { onClientClose } = this.callbacks; |
{ | ||
"name": "@onflow/cadence-language-server", | ||
"version": "0.33.2", | ||
"version": "0.33.3", | ||
"description": "The Cadence Language Server", | ||
@@ -17,14 +17,16 @@ "homepage": "https://github.com/onflow/cadence", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.14", | ||
"jest": "^26.5.3", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^20.9.0", | ||
"jest": "^29.7.0", | ||
"node-fetch": "^2.6.1", | ||
"ts-jest": "^26.4.1", | ||
"typescript": "^4.0.2" | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.2.2", | ||
"vscode-languageserver-protocol": "^3.17.5" | ||
}, | ||
"dependencies": { | ||
"vscode-jsonrpc": "^5.0.1" | ||
}, | ||
"files": [ | ||
"dist/**/*" | ||
] | ||
], | ||
"dependencies": { | ||
"vscode-jsonrpc": "^8.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
715
42076029
7
+ Addedvscode-jsonrpc@8.2.1(transitive)
- Removedvscode-jsonrpc@5.0.1(transitive)
Updatedvscode-jsonrpc@^8.2.0