ts-plugin. Works in VS Code, haven't managed to configure Emacs to work with it yet.
This commit is contained in:
parent
7b9f035fa8
commit
d8b60ccf76
|
@ -2,13 +2,17 @@
|
||||||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||||
|
|
||||||
import { BoxState, SetBox, N } from './protocol.js';
|
import { BoxState, SetBox, N } from './protocol.js';
|
||||||
|
import { Ref } from '@syndicate-lang/core';
|
||||||
|
|
||||||
boot {
|
export function boot(ds: Ref) {
|
||||||
spawn named 'box' {
|
spawn named 'box' {
|
||||||
field value: number = 0;
|
field boxValue: number = 0;
|
||||||
assert BoxState(this.value);
|
at ds {
|
||||||
stop on (this.value === N)
|
assert BoxState(boxValue.value);
|
||||||
|
on message SetBox($v: number) => boxValue.value = v;
|
||||||
|
}
|
||||||
|
stop on (boxValue.value === N) {
|
||||||
console.log('terminated box root facet');
|
console.log('terminated box root facet');
|
||||||
on message SetBox($v: number) => this.value = v;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,16 @@
|
||||||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||||
|
|
||||||
import { BoxState, SetBox } from './protocol.js';
|
import { BoxState, SetBox } from './protocol.js';
|
||||||
|
import { Ref } from '@syndicate-lang/core';
|
||||||
|
|
||||||
boot {
|
export function boot(ds: Ref, doneCallback: () => void) {
|
||||||
spawn named 'client' {
|
spawn named 'client' {
|
||||||
on asserted BoxState($v: number) => send message SetBox(v + 1);
|
at ds {
|
||||||
on retracted BoxState(_) => console.log('box gone');
|
on asserted BoxState($v: number) => send message SetBox(v + 1);
|
||||||
|
on retracted BoxState(_) => {
|
||||||
|
console.log('box gone');
|
||||||
|
doneCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||||
|
|
||||||
import { N } from './protocol.js';
|
import { N } from './protocol.js';
|
||||||
activate import './box.js';
|
import * as Box from './box.js';
|
||||||
activate import './client.js';
|
import * as Client from './client.js';
|
||||||
|
import { Actor, Dataspace, Turn } from '@syndicate-lang/core';
|
||||||
|
|
||||||
console.time('box-and-client-' + N.toString());
|
console.time('box-and-client-' + N.toString());
|
||||||
boot {
|
Actor.boot(() => {
|
||||||
thisFacet.actor.dataspace.ground().addStopHandler(() =>
|
Turn.activeFacet.preventInertCheck();
|
||||||
console.timeEnd('box-and-client-' + N.toString()));
|
const ds = create new Dataspace();
|
||||||
}
|
Box.boot(ds);
|
||||||
|
Client.boot(ds, () => console.timeEnd('box-and-client-' + N.toString()));
|
||||||
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/// SPDX-License-Identifier: GPL-3.0-or-later
|
/// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||||
|
|
||||||
export assertion type BoxState(value);
|
export assertion type BoxState(value: number);
|
||||||
export message type SetBox(newValue);
|
export message type SetBox(newValue: number);
|
||||||
|
|
||||||
export const N = 100000;
|
export const N = 100000;
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
"@syndicate-lang/core": "^0.6.0"
|
"@syndicate-lang/core": "^0.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ const boot: tslib.server.PluginModuleFactory = ({ typescript: ts }) => {
|
||||||
return sf;
|
return sf;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
onError?.(e.message);
|
onError?.((e as any).message ?? '<no error message available>');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,6 +223,10 @@ const boot: tslib.server.PluginModuleFactory = ({ typescript: ts }) => {
|
||||||
this.inner = inner;
|
this.inner = inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provideInlayHints(fileName: string, span: ts.TextSpan, preferences: ts.UserPreferences | undefined): ts.InlayHint[] {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
|
||||||
getFileReferences(fileName: string): tslib.ReferenceEntry[] {
|
getFileReferences(fileName: string): tslib.ReferenceEntry[] {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
|
@ -330,13 +334,19 @@ const boot: tslib.server.PluginModuleFactory = ({ typescript: ts }) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: ts.FormatCodeOptions | ts.FormatCodeSettings | undefined, source: string | undefined, preferences: ts.UserPreferences | undefined): ts.CompletionEntryDetails | undefined {
|
getCompletionEntryDetails(fileName: string,
|
||||||
|
position: number,
|
||||||
|
entryName: string,
|
||||||
|
formatOptions: ts.FormatCodeOptions | ts.FormatCodeSettings | undefined,
|
||||||
|
source: string | undefined,
|
||||||
|
preferences: ts.UserPreferences | undefined,
|
||||||
|
data: ts.CompletionEntryData | undefined): ts.CompletionEntryDetails | undefined {
|
||||||
return withPosition(
|
return withPosition(
|
||||||
fileName, position,
|
fileName, position,
|
||||||
() => this.inner.getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences),
|
() => this.inner.getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data),
|
||||||
() => void 0,
|
() => void 0,
|
||||||
(fixup) => {
|
(fixup) => {
|
||||||
const d = this.inner.getCompletionEntryDetails(fileName, fixup.targetStart, entryName, formatOptions, source, preferences);
|
const d = this.inner.getCompletionEntryDetails(fileName, fixup.targetStart, entryName, formatOptions, source, preferences, data);
|
||||||
if (d !== void 0) {
|
if (d !== void 0) {
|
||||||
d.codeActions?.forEach(a =>
|
d.codeActions?.forEach(a =>
|
||||||
a.changes.forEach(c =>
|
a.changes.forEach(c =>
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/yargs": "^15.0.12",
|
"@types/yargs": "^15.0.12",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue