slintpad/vscode: Get rid of the shared files

Theyre are no more shared files, so move the files
into vscode and set up a syntax check over there.

That was not possible before as the typescript
compiler would error out on the shared files being
outside its root directory.
This commit is contained in:
Tobias Hunger 2024-08-09 11:09:26 +00:00
parent 49d0c96a9e
commit 1639274486
8 changed files with 37 additions and 41 deletions

View file

@ -195,6 +195,7 @@
"watch": "tsc -watch -p ./", "watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint", "pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts", "lint": "eslint src --ext ts",
"syntax_check": "tsc --build --force",
"test": "node ./out/test/runTest.js", "test": "node ./out/test/runTest.js",
"clean": "shx rm -rf out bin LICENSE.txt slint-*.vsix" "clean": "shx rm -rf out bin LICENSE.txt slint-*.vsix"
}, },

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import slint_init, * as slint_lsp from "../out/slint_lsp_wasm.js"; import slint_init, * as slint_lsp from "../out/slint_lsp_wasm.js";
import slint_wasm_data from "../out/slint_lsp_wasm_bg.wasm";
import { InitializeParams, InitializeResult } from "vscode-languageserver"; import { InitializeParams, InitializeResult } from "vscode-languageserver";
import { import {
createConnection, createConnection,
@ -10,7 +9,7 @@ import {
BrowserMessageWriter, BrowserMessageWriter,
} from "vscode-languageserver/browser"; } from "vscode-languageserver/browser";
slint_init(slint_wasm_data).then((_) => { slint_init().then((_) => {
const reader = new BrowserMessageReader(self); const reader = new BrowserMessageReader(self);
const writer = new BrowserMessageWriter(self); const writer = new BrowserMessageWriter(self);

View file

@ -8,7 +8,7 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import * as wasm_preview from "./wasm_preview"; import * as wasm_preview from "./wasm_preview";
import * as lsp_commands from "../../../tools/slintpad/src/shared/lsp_commands"; import * as lsp_commands from "./lsp_commands";
import * as snippets from "./snippets"; import * as snippets from "./snippets";
import { import {

View file

@ -1,17 +1,9 @@
// Copyright © SixtyFPS GmbH <info@slint.dev> // Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import { import { URI as LspURI } from "vscode-languageserver-types";
OptionalVersionedTextDocumentIdentifier,
Range as LspRange,
URI as LspURI,
WorkspaceEdit,
} from "vscode-languageserver-types";
import * as vscode from "vscode"; import * as vscode from "vscode";
export type WorkspaceEditor = (_we: WorkspaceEdit) => boolean;
// Use the auto-registered VSCode command for the custom executables offered // Use the auto-registered VSCode command for the custom executables offered
// by our language server. // by our language server.
// //
@ -32,16 +24,3 @@ export async function showPreview(
): Promise<unknown> { ): Promise<unknown> {
return vscode.commands.executeCommand("slint/showPreview", url, component); return vscode.commands.executeCommand("slint/showPreview", url, component);
} }
export async function removeBinding(
doc: OptionalVersionedTextDocumentIdentifier,
element_range: LspRange,
property_name: string,
): Promise<boolean> {
return vscode.commands.executeCommand(
"slint/removeBinding",
doc,
element_range,
property_name,
);
}

View file

@ -0,0 +1,8 @@
{
"extends": "../tsconfig.default.json",
"compilerOptions": {
"lib": ["es2021", "webworker"],
"types": ["vscode"]
},
"include": ["./*.ts"],
}

View file

@ -0,0 +1,18 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"baseUrl": "./node_modules",
"composite": true,
"declaration": true,
"declarationMap": true,
"lib": ["es2021"],
"module": "esnext",
"moduleResolution": "node",
"outDir": "./out",
"rootDir": ".",
"skipLibCheck": true,
"strict": true,
"target": "es6",
"typeRoots": ["./node_modules/@types"]
}
}

View file

@ -1,17 +1,8 @@
{ {
"compilerOptions": { "files": [],
"module": "commonjs", "references": [
"target": "es2020", {
"outDir": "out", "path": "src"
"lib": ["es2021", "WebWorker", "dom"], }
"sourceMap": true, ]
"rootDir": ".",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a
// value. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in
// switch statement. */ "noUnusedParameters": true, /* Report errors on unused parameters.
// */
},
"exclude": ["node_modules", ".vscode-test"]
} }

View file

@ -4,7 +4,7 @@
"lib": ["dom", "es2021"], "lib": ["dom", "es2021"],
"types": ["vscode"] "types": ["vscode"]
}, },
"include": ["./*.ts", "./shared/*.ts", "../package.json", "./welcome/*.ts"], "include": ["./*.ts", "../package.json", "./welcome/*.ts"],
"references": [ "references": [
{ {
"path": "worker" "path": "worker"