mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
commit
784919aec1
7 changed files with 903 additions and 81 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
@ -95,5 +95,7 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
working-directory: ./editors/code
|
working-directory: ./editors/code
|
||||||
|
- run: npm run fmt
|
||||||
|
working-directory: ./editors/code
|
||||||
- run: npm run package --scripts-prepend-node-path
|
- run: npm run package --scripts-prepend-node-path
|
||||||
working-directory: ./editors/code
|
working-directory: ./editors/code
|
||||||
|
|
34
editors/code/.eslintrc.js
Normal file
34
editors/code/.eslintrc.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "tsconfig.json",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/member-delimiter-style": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"multiline": {
|
||||||
|
"delimiter": "semi",
|
||||||
|
"requireLast": true
|
||||||
|
},
|
||||||
|
"singleline": {
|
||||||
|
"delimiter": "semi",
|
||||||
|
"requireLast": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"prefer-const": "error"
|
||||||
|
}
|
||||||
|
};
|
892
editors/code/package-lock.json
generated
892
editors/code/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -22,7 +22,7 @@
|
||||||
"vscode:prepublish": "tsc && rollup -c",
|
"vscode:prepublish": "tsc && rollup -c",
|
||||||
"package": "vsce package -o rust-analyzer.vsix",
|
"package": "vsce package -o rust-analyzer.vsix",
|
||||||
"watch": "tsc --watch",
|
"watch": "tsc --watch",
|
||||||
"fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix"
|
"fmt": "tsfmt -r && eslint -c .eslintrc.js --ext ts ./src/ --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsonc-parser": "^2.1.0",
|
"jsonc-parser": "^2.1.0",
|
||||||
|
@ -37,9 +37,11 @@
|
||||||
"@types/node-fetch": "^2.5.4",
|
"@types/node-fetch": "^2.5.4",
|
||||||
"@types/throttle-debounce": "^2.1.0",
|
"@types/throttle-debounce": "^2.1.0",
|
||||||
"@types/vscode": "^1.42.0",
|
"@types/vscode": "^1.42.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.20.0",
|
||||||
|
"@typescript-eslint/parser": "^2.20.0",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
"rollup": "^1.31.1",
|
"rollup": "^1.31.1",
|
||||||
"tslib": "^1.10.0",
|
"tslib": "^1.10.0",
|
||||||
"tslint": "^5.20.1",
|
|
||||||
"typescript": "^3.7.5",
|
"typescript": "^3.7.5",
|
||||||
"typescript-formatter": "^7.2.2",
|
"typescript-formatter": "^7.2.2",
|
||||||
"vsce": "^1.73.0"
|
"vsce": "^1.73.0"
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class Config {
|
||||||
"cargoFeatures",
|
"cargoFeatures",
|
||||||
"cargo-watch",
|
"cargo-watch",
|
||||||
]
|
]
|
||||||
.map(opt => `${Config.rootSection}.${opt}`);
|
.map(opt => `${Config.rootSection}.${opt}`);
|
||||||
|
|
||||||
private static readonly extensionVersion: string = (() => {
|
private static readonly extensionVersion: string = (() => {
|
||||||
const packageJsonVersion = vscode
|
const packageJsonVersion = vscode
|
||||||
|
@ -96,7 +96,7 @@ export class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "darwin": return "ra_lsp_server-mac";
|
case "darwin": return "ra_lsp_server-mac";
|
||||||
case "win32": return "ra_lsp_server-windows.exe";
|
case "win32": return "ra_lsp_server-windows.exe";
|
||||||
|
|
||||||
// Users on these platforms yet need to manually build from sources
|
// Users on these platforms yet need to manually build from sources
|
||||||
case "aix":
|
case "aix":
|
||||||
|
@ -126,7 +126,7 @@ export class Config {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: BinarySource.Type.GithubRelease,
|
type: BinarySource.Type.GithubRelease,
|
||||||
dir: this.ctx.globalStoragePath,
|
dir: this.ctx.globalStoragePath,
|
||||||
file: prebuiltBinaryName,
|
file: prebuiltBinaryName,
|
||||||
storage: this.ctx.globalState,
|
storage: this.ctx.globalState,
|
||||||
version: Config.extensionVersion,
|
version: Config.extensionVersion,
|
||||||
|
@ -140,30 +140,30 @@ export class Config {
|
||||||
// We don't do runtime config validation here for simplicity. More on stackoverflow:
|
// We don't do runtime config validation here for simplicity. More on stackoverflow:
|
||||||
// https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
|
// https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
|
||||||
|
|
||||||
get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
|
get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
|
||||||
get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
|
get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
|
||||||
get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
|
get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
|
||||||
get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; }
|
get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; }
|
||||||
get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; }
|
get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; }
|
||||||
get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
|
get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
|
||||||
get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
|
get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
|
||||||
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
|
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
|
||||||
get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
|
get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
|
||||||
|
|
||||||
get cargoWatchOptions(): CargoWatchOptions {
|
get cargoWatchOptions(): CargoWatchOptions {
|
||||||
return {
|
return {
|
||||||
enable: this.cfg.get("cargo-watch.enable") as boolean,
|
enable: this.cfg.get("cargo-watch.enable") as boolean,
|
||||||
arguments: this.cfg.get("cargo-watch.arguments") as string[],
|
arguments: this.cfg.get("cargo-watch.arguments") as string[],
|
||||||
allTargets: this.cfg.get("cargo-watch.allTargets") as boolean,
|
allTargets: this.cfg.get("cargo-watch.allTargets") as boolean,
|
||||||
command: this.cfg.get("cargo-watch.command") as string,
|
command: this.cfg.get("cargo-watch.command") as string,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get cargoFeatures(): CargoFeatures {
|
get cargoFeatures(): CargoFeatures {
|
||||||
return {
|
return {
|
||||||
noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean,
|
noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean,
|
||||||
allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean,
|
allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean,
|
||||||
features: this.cfg.get("cargoFeatures.features") as string[],
|
features: this.cfg.get("cargoFeatures.features") as string[],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ export async function fetchArtifactReleaseInfo(
|
||||||
): Promise<null | ArtifactReleaseInfo> {
|
): Promise<null | ArtifactReleaseInfo> {
|
||||||
|
|
||||||
const repoOwner = encodeURIComponent(repo.owner);
|
const repoOwner = encodeURIComponent(repo.owner);
|
||||||
const repoName = encodeURIComponent(repo.name);
|
const repoName = encodeURIComponent(repo.name);
|
||||||
|
|
||||||
const apiEndpointPath = releaseTag
|
const apiEndpointPath = releaseTag
|
||||||
? `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}`
|
? `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}`
|
||||||
|
@ -28,8 +28,8 @@ export async function fetchArtifactReleaseInfo(
|
||||||
|
|
||||||
// FIXME: handle non-ok response
|
// FIXME: handle non-ok response
|
||||||
const response: GithubRelease = await fetch(requestUrl, {
|
const response: GithubRelease = await fetch(requestUrl, {
|
||||||
headers: { Accept: "application/vnd.github.v3+json" }
|
headers: { Accept: "application/vnd.github.v3+json" }
|
||||||
})
|
})
|
||||||
.then(res => res.json());
|
.then(res => res.json());
|
||||||
|
|
||||||
const artifact = response.assets.find(artifact => artifact.name === artifactFileName);
|
const artifact = response.assets.find(artifact => artifact.name === artifactFileName);
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [
|
|
||||||
true,
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"prefer-const": true,
|
|
||||||
"no-floating-promises": true
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue