mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 13:18:47 +00:00
Minimize TypeScript build
This commit is contained in:
parent
7192ee842d
commit
5846221a39
11 changed files with 42 additions and 1864 deletions
26
.vscode/launch.json
vendored
26
.vscode/launch.json
vendored
|
@ -10,18 +10,28 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"runtimeExecutable": "${execPath}",
|
"runtimeExecutable": "${execPath}",
|
||||||
"args": [
|
"args": [
|
||||||
"--disable-extensions",
|
|
||||||
"--user-data-dir",
|
|
||||||
"${workspaceFolder}/target/vscode",
|
|
||||||
"--extensionDevelopmentPath=${workspaceFolder}/editors/code"
|
"--extensionDevelopmentPath=${workspaceFolder}/editors/code"
|
||||||
],
|
],
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceFolder}/editors/code/out/**/*.js"
|
||||||
|
],
|
||||||
|
"preLaunchTask": "Build Extension"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Run Extension (Dev Server)",
|
||||||
|
"type": "extensionHost",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "${execPath}",
|
||||||
|
"args": [
|
||||||
|
"--extensionDevelopmentPath=${workspaceFolder}/editors/code"
|
||||||
|
],
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceFolder}/editors/code/out/**/*.js"
|
||||||
|
],
|
||||||
|
"preLaunchTask": "Build Extension",
|
||||||
"env": {
|
"env": {
|
||||||
"__RA_LSP_SERVER_DEBUG": "${workspaceFolder}/target/debug/ra_lsp_server"
|
"__RA_LSP_SERVER_DEBUG": "${workspaceFolder}/target/debug/ra_lsp_server"
|
||||||
},
|
}
|
||||||
"outFiles": [
|
|
||||||
"${workspaceFolder}/editors/code/bundle/**/*.js"
|
|
||||||
],
|
|
||||||
"preLaunchTask": "Build All"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Debug Lsp Server",
|
"name": "Debug Lsp Server",
|
||||||
|
|
27
.vscode/tasks.json
vendored
27
.vscode/tasks.json
vendored
|
@ -5,32 +5,25 @@
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "Build Extension",
|
"label": "Build Extension",
|
||||||
|
"group": "build",
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"script": "compile",
|
"script": "watch",
|
||||||
|
"path": "editors/code/",
|
||||||
"problemMatcher": {
|
"problemMatcher": {
|
||||||
"owner": "typescript",
|
"base": "$tsc-watch",
|
||||||
"pattern": "$tsc",
|
"fileLocation": ["relative", "${workspaceFolder}/editors/code/"]
|
||||||
"fileLocation": [
|
},
|
||||||
"relative",
|
"isBackground": true,
|
||||||
"${workspaceRoot}/editors/code"
|
"presentation": {
|
||||||
]
|
"reveal": "never"
|
||||||
},
|
},
|
||||||
"path": "editors/code/"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Build Server",
|
"label": "Build Server",
|
||||||
|
"group": "build",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "cargo build --package ra_lsp_server",
|
"command": "cargo build --package ra_lsp_server",
|
||||||
"problemMatcher": "$rustc"
|
"problemMatcher": "$rustc"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "Build All",
|
|
||||||
"group": "build",
|
|
||||||
"dependsOn": [
|
|
||||||
"Build Extension",
|
|
||||||
"Build Server"
|
|
||||||
],
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
node_modules/
|
|
||||||
.vscode-test/
|
|
|
@ -1,9 +0,0 @@
|
||||||
.vscode/**
|
|
||||||
.vscode-test/**
|
|
||||||
out/**
|
|
||||||
src/**
|
|
||||||
.gitignore
|
|
||||||
tsconfig.json
|
|
||||||
vsc-extension-quickstart.md
|
|
||||||
tslint.json
|
|
||||||
node_modules/**
|
|
1675
editors/code/package-lock.json
generated
1675
editors/code/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -17,47 +17,20 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
"package": "vsce package",
|
"compile": "tsc -p ./",
|
||||||
"compile": "rollup -c",
|
"watch": "tsc -watch -p ./"
|
||||||
"watch": "tsc -watch -p ./",
|
|
||||||
"fix": "prettier **/*.{json,ts} --write && tslint --project . --fix",
|
|
||||||
"lint": "tslint --project .",
|
|
||||||
"prettier": "prettier **/*.{json,ts}",
|
|
||||||
"test": "tsc -p . && node ./out/test/runTest.js",
|
|
||||||
"travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --write && git diff --exit-code"
|
|
||||||
},
|
|
||||||
"prettier": {
|
|
||||||
"singleQuote": true,
|
|
||||||
"tabWidth": 4,
|
|
||||||
"trailingComma": "all"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lookpath": "^1.0.4",
|
|
||||||
"seedrandom": "^3.0.5",
|
|
||||||
"vscode-languageclient": "^6.0.0-next.9",
|
"vscode-languageclient": "^6.0.0-next.9",
|
||||||
"jsonc-parser": "^2.1.0"
|
"jsonc-parser": "^2.1.0",
|
||||||
|
"lookpath": "^1.0.4",
|
||||||
|
"seedrandom": "^3.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "^7.1.1",
|
|
||||||
"@types/mocha": "^5.2.7",
|
|
||||||
"@types/node": "^12.12.21",
|
"@types/node": "^12.12.21",
|
||||||
"@types/seedrandom": "^2.4.28",
|
|
||||||
"@types/vscode": "^1.41.0",
|
"@types/vscode": "^1.41.0",
|
||||||
"glob": "^7.1.6",
|
"@types/seedrandom": "^2.4.28",
|
||||||
"mocha": "^6.2.2",
|
"typescript": "^3.7.3"
|
||||||
"prettier": "^1.19.1",
|
|
||||||
"rollup": "^1.27.13",
|
|
||||||
"rollup-plugin-commonjs": "^10.1.0",
|
|
||||||
"rollup-plugin-node-resolve": "^5.2.0",
|
|
||||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
|
||||||
"rollup-plugin-typescript": "^1.0.1",
|
|
||||||
"shx": "^0.3.1",
|
|
||||||
"tslint": "^5.20.1",
|
|
||||||
"tslint-config-prettier": "^1.18.0",
|
|
||||||
"tslint-plugin-prettier": "^2.0.1",
|
|
||||||
"typescript": "^3.7.3",
|
|
||||||
"vsce": "^1.71.0",
|
|
||||||
"vscode-test": "^1.3.0"
|
|
||||||
},
|
},
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"onLanguage:rust",
|
"onLanguage:rust",
|
||||||
|
@ -65,7 +38,7 @@
|
||||||
"onCommand:rust-analyzer.collectGarbage",
|
"onCommand:rust-analyzer.collectGarbage",
|
||||||
"workspaceContains:**/Cargo.toml"
|
"workspaceContains:**/Cargo.toml"
|
||||||
],
|
],
|
||||||
"main": "./bundle/extension",
|
"main": "./out/extension",
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"taskDefinitions": [
|
"taskDefinitions": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
import typescript from 'rollup-plugin-typescript';
|
|
||||||
import resolve from 'rollup-plugin-node-resolve';
|
|
||||||
import commonjs from 'rollup-plugin-commonjs';
|
|
||||||
import sourcemaps from 'rollup-plugin-sourcemaps'
|
|
||||||
import nodeBuiltins from 'builtin-modules';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
input: './src/extension.ts',
|
|
||||||
plugins: [
|
|
||||||
typescript(),
|
|
||||||
sourcemaps(),
|
|
||||||
resolve(),
|
|
||||||
commonjs({
|
|
||||||
namedExports: {
|
|
||||||
// squelch missing import warnings
|
|
||||||
'vscode-languageclient': [ 'CreateFile', 'RenameFile' ]
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
// keep these as require() calls, bundle the rest
|
|
||||||
external: [
|
|
||||||
...nodeBuiltins,
|
|
||||||
'vscode',
|
|
||||||
],
|
|
||||||
output: {
|
|
||||||
file: './bundle/extension.js',
|
|
||||||
sourcemap: true,
|
|
||||||
format: 'cjs',
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,22 +0,0 @@
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import { runTests } from 'vscode-test';
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
try {
|
|
||||||
// The folder containing the Extension Manifest package.json
|
|
||||||
// Passed to `--extensionDevelopmentPath`
|
|
||||||
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
|
|
||||||
|
|
||||||
// The path to the extension test runner script
|
|
||||||
// Passed to --extensionTestsPath
|
|
||||||
const extensionTestsPath = path.resolve(__dirname, './utils/index');
|
|
||||||
|
|
||||||
// Download VS Code, unzip it and run the integration test
|
|
||||||
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
|
||||||
} catch (err) {
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,49 +0,0 @@
|
||||||
//
|
|
||||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
|
||||||
//
|
|
||||||
// This file is providing the test runner to use when running extension tests.
|
|
||||||
// By default the test runner in use is Mocha based.
|
|
||||||
//
|
|
||||||
// You can provide your own test runner if you want to override it by exporting
|
|
||||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
|
||||||
// host can call to run the tests. The test runner is expected to use console.log
|
|
||||||
// to report the results back to the caller. When the tests are finished, return
|
|
||||||
// a possible error to the callback or null if none.
|
|
||||||
|
|
||||||
import * as glob from 'glob';
|
|
||||||
import * as Mocha from 'mocha';
|
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
export function run(): Promise<void> {
|
|
||||||
// Create the mocha test
|
|
||||||
const mocha = new Mocha({
|
|
||||||
ui: 'bdd',
|
|
||||||
});
|
|
||||||
mocha.useColors(true);
|
|
||||||
|
|
||||||
const testsRoot = __dirname;
|
|
||||||
|
|
||||||
return new Promise((c, e) => {
|
|
||||||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
|
|
||||||
if (err) {
|
|
||||||
return e(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add files to the test suite
|
|
||||||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Run the mocha test
|
|
||||||
mocha.run(failures => {
|
|
||||||
if (failures > 0) {
|
|
||||||
e(new Error(`${failures} tests failed.`));
|
|
||||||
} else {
|
|
||||||
c();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
e(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -3,7 +3,9 @@
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es2018",
|
"target": "es2018",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"lib": ["es2018"],
|
"lib": [
|
||||||
|
"es2018"
|
||||||
|
],
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
@ -12,5 +14,7 @@
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", ".vscode-test"]
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"defaultSeverity": "error",
|
|
||||||
"extends": [
|
|
||||||
"tslint:recommended",
|
|
||||||
"tslint-config-prettier",
|
|
||||||
"tslint-plugin-prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"interface-name": false,
|
|
||||||
"prettier": true,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
// Allow `_bar` to sort with tsc's `noUnusedParameters` option
|
|
||||||
"variable-name": [true, "allow-leading-underscore"]
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue