qsharp-lang 0.1.0-dev.1 → 1.0.5-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/dist/compiler/compiler.d.ts +2 -0
- package/dist/compiler/compiler.js +4 -1
- package/dist/compiler/worker-proxy.js +1 -0
- package/dist/debug-service/debug-service.js +11 -30
- package/dist/katas-content.generated.js +26 -26
- package/dist/language-service/language-service.d.ts +11 -7
- package/dist/language-service/language-service.js +54 -3
- package/dist/language-service/worker-proxy.js +2 -0
- package/lib/node/qsc_wasm.cjs +151 -177
- package/lib/node/qsc_wasm.d.cts +154 -139
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm.d.ts +169 -156
- package/lib/web/qsc_wasm.js +146 -172
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +3 -2
- package/LICENSE.txt +0 -21
package/README.md
CHANGED
|
@@ -68,7 +68,3 @@ at <src/vs/base/common/cancellation.ts>. This code uses a simplified version of
|
|
|
68
68
|
|
|
69
69
|
Node.js tests can be run via `node --test` (see
|
|
70
70
|
<https://nodejs.org/dist/latest-v18.x/docs/api/test.html#test-runner-execution-model>).
|
|
71
|
-
|
|
72
|
-
The test module was also added to Node.js v16.17.0, and Electron 22 (which VS Code plans to move to
|
|
73
|
-
in first half of 2023) includes v16.17.1, so v16.17 should be our minimum Node.js
|
|
74
|
-
version supported (it shipped in Aug 2022).
|
|
@@ -9,6 +9,7 @@ export interface ICompiler {
|
|
|
9
9
|
checkCode(code: string): Promise<VSDiagnostic[]>;
|
|
10
10
|
getHir(code: string): Promise<string>;
|
|
11
11
|
run(code: string, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
|
|
12
|
+
getQir(code: string): Promise<string>;
|
|
12
13
|
checkExerciseSolution(user_code: string, exercise_sources: string[], eventHandler: IQscEventTarget): Promise<boolean>;
|
|
13
14
|
}
|
|
14
15
|
export type ICompilerWorker = ICompiler & IServiceProxy;
|
|
@@ -20,6 +21,7 @@ export declare class Compiler implements ICompiler {
|
|
|
20
21
|
* @deprecated use the language service for errors and other editor features.
|
|
21
22
|
*/
|
|
22
23
|
checkCode(code: string): Promise<VSDiagnostic[]>;
|
|
24
|
+
getQir(code: string): Promise<string>;
|
|
23
25
|
getHir(code: string): Promise<string>;
|
|
24
26
|
run(code: string, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
|
|
25
27
|
checkExerciseSolution(user_code: string, exercise_sources: string[], eventHandler: IQscEventTarget): Promise<boolean>;
|
|
@@ -18,9 +18,12 @@ export class Compiler {
|
|
|
18
18
|
const languageService = new this.wasm.LanguageService((uri, version, errors) => {
|
|
19
19
|
diags = errors;
|
|
20
20
|
});
|
|
21
|
-
languageService.update_document("code", 1, code
|
|
21
|
+
languageService.update_document("code", 1, code);
|
|
22
22
|
return mapDiagnostics(diags, code);
|
|
23
23
|
}
|
|
24
|
+
async getQir(code) {
|
|
25
|
+
return this.wasm.get_qir(code);
|
|
26
|
+
}
|
|
24
27
|
async getHir(code) {
|
|
25
28
|
return this.wasm.get_hir(code);
|
|
26
29
|
}
|
|
@@ -45,26 +45,22 @@ export class QSharpDebugService {
|
|
|
45
45
|
async evalNext(bps, eventHandler) {
|
|
46
46
|
const event_cb = (msg) => onCompilerEvent(msg, eventHandler);
|
|
47
47
|
const ids = new Uint32Array(bps);
|
|
48
|
-
|
|
49
|
-
return { id: result.id, value: result.value };
|
|
48
|
+
return this.debugService.eval_next(event_cb, ids);
|
|
50
49
|
}
|
|
51
50
|
async evalStepIn(bps, eventHandler) {
|
|
52
51
|
const event_cb = (msg) => onCompilerEvent(msg, eventHandler);
|
|
53
52
|
const ids = new Uint32Array(bps);
|
|
54
|
-
|
|
55
|
-
return { id: result.id, value: result.value };
|
|
53
|
+
return this.debugService.eval_step_in(event_cb, ids);
|
|
56
54
|
}
|
|
57
55
|
async evalStepOut(bps, eventHandler) {
|
|
58
56
|
const event_cb = (msg) => onCompilerEvent(msg, eventHandler);
|
|
59
57
|
const ids = new Uint32Array(bps);
|
|
60
|
-
|
|
61
|
-
return { id: result.id, value: result.value };
|
|
58
|
+
return this.debugService.eval_step_out(event_cb, ids);
|
|
62
59
|
}
|
|
63
60
|
async evalContinue(bps, eventHandler) {
|
|
64
61
|
const event_cb = (msg) => onCompilerEvent(msg, eventHandler);
|
|
65
62
|
const ids = new Uint32Array(bps);
|
|
66
|
-
|
|
67
|
-
return { id: result.id, value: result.value };
|
|
63
|
+
return this.debugService.eval_continue(event_cb, ids);
|
|
68
64
|
}
|
|
69
65
|
async getBreakpoints(path) {
|
|
70
66
|
const breakpoint_list = this.debugService.get_breakpoints(path);
|
|
@@ -75,35 +71,20 @@ export class QSharpDebugService {
|
|
|
75
71
|
positions.push(span.hi);
|
|
76
72
|
});
|
|
77
73
|
const positionMap = mapUtf8UnitsToUtf16Units(positions, this.code[path]);
|
|
78
|
-
const breakpoint_spans = breakpoint_list.spans.map((span) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return result;
|
|
84
|
-
});
|
|
74
|
+
const breakpoint_spans = breakpoint_list.spans.map((span) => ({
|
|
75
|
+
id: span.id,
|
|
76
|
+
lo: positionMap[span.lo],
|
|
77
|
+
hi: positionMap[span.hi],
|
|
78
|
+
}));
|
|
85
79
|
return breakpoint_spans;
|
|
86
80
|
}
|
|
87
81
|
async captureQuantumState() {
|
|
88
82
|
const state = this.debugService.capture_quantum_state();
|
|
89
|
-
|
|
90
|
-
const result = {};
|
|
91
|
-
result.name = entry.name;
|
|
92
|
-
result.value = entry.value;
|
|
93
|
-
return result;
|
|
94
|
-
});
|
|
95
|
-
return entries;
|
|
83
|
+
return state.entries;
|
|
96
84
|
}
|
|
97
85
|
async getLocalVariables() {
|
|
98
86
|
const variable_list = this.debugService.get_locals();
|
|
99
|
-
|
|
100
|
-
const result = {};
|
|
101
|
-
result.name = variable.name;
|
|
102
|
-
result.value = variable.value;
|
|
103
|
-
result.var_type = variable.var_type;
|
|
104
|
-
return result;
|
|
105
|
-
});
|
|
106
|
-
return variables;
|
|
87
|
+
return variable_list.variables;
|
|
107
88
|
}
|
|
108
89
|
async dispose() {
|
|
109
90
|
this.debugService.free();
|