Skip to content

Commit

Permalink
Merge branch 'mesonbuild:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CyborgPotato authored Apr 15, 2024
2 parents ed5065a + 0e06d33 commit c6059b3
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = true
commit_args = -S
current_version = 1.22.0
current_version = 1.23.0
sign_tags = true
tag = true

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ jobs:
id: publishToOpenVSX
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
skipDuplicate: true
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
skipDuplicate: true
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

## next

## 1.23.0

⚠️⚠️ It's important to update, as it contains a version of mesonlsp that is not
vulnerable to CVE-2024-30254. ⚠️⚠️

- Replace `Swift-MesonLSP` by `mesonlsp`. This requires migrating your settings
from `mesonbuild.Swift-MesonLSP.*` to `mesonbuild.mesonlsp.*`.
- Add `mesonbuild.mesonlsp.others.defaultFormattingConfig` to set the default
formatting configuration.
- Add `mesonbuild.mesonlsp.others.removeDefaultTypesInInlayHints` to reduce
clutter in inlay hints.
- Add `mesonbuild.mesonlsp.others.disablePosargInlayHints` to disable inlay
hints for positional arguments.
- Add `mesonbuild.mesonlsp.others.useCustomParser` to allow switching between
the handwritten parse and the tree-sitter based parser.
- Add `mesonbuild.mesonlsp.linting.disableUnusedVariableCheck` to disable
diagnostics for unused variables.
- Add `mesonbuild.mesonlsp.linting.disableArgTypeChecking` to disable validation
for argument types.

## 1.22.0

- Add `mesonbuild.configureEnvironment` to set additional environment variables
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension on the store, and only that one is released from this repository.

[^0]:
Requires an installation of
[Swift-MesonLSP](https://github.com/JCWasmx86/Swift-MesonLSP) or
[mesonlsp](https://github.com/JCWasmx86/mesonlsp) or
[muon](https://muon.build).

[^1]: Requires an installation of muon.
62 changes: 48 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Meson",
"description": "Meson language support for Visual Studio Code",
"icon": "graphics/icon.png",
"version": "1.22.0",
"version": "1.23.0",
"license": "Apache-2.0",
"publisher": "mesonbuild",
"author": {
Expand Down Expand Up @@ -219,12 +219,13 @@
"string",
"null"
],
"default": "Swift-MesonLSP",
"default": "mesonlsp",
"enum": [
"Swift-MesonLSP",
"mesonlsp",
null
],
"description": "Select which language server to use"
"description": "Select which language server to use. Swift-MesonLSP is a legacy alias for mesonlsp."
},
"mesonbuild.languageServerPath": {
"type": "string",
Expand Down Expand Up @@ -263,58 +264,91 @@
"default": true,
"markdownDescription": "Automatically setup other extensions to use files generated by Meson. Set it to `false` if for example `.vscode/settings.json` is committed into git and should not be modified. It can also be an array of extension IDs of the following:\n- [`ms-vscode.cpptools`](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)\n- [`rust-lang.rust-analyzer`](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)."
},
"mesonbuild.Swift-MesonLSP.others.ignoreDiagnosticsFromSubprojects": {
"mesonbuild.mesonlsp.others.defaultFormattingConfig": {
"type": [
"null",
"string"
],
"default": null,
"description": "Default muon config to use for formatting"
},
"mesonbuild.mesonlsp.others.ignoreDiagnosticsFromSubprojects": {
"type": [
"boolean",
"array"
],
"default": false,
"description": "Ignore diagnostics from either all subprojects (if true) or from selected subprojects (if the value is an array)"
},
"mesonbuild.Swift-MesonLSP.others.disableInlayHints": {
"mesonbuild.mesonlsp.others.disableInlayHints": {
"type": "boolean",
"default": false,
"description": "Disable inlay hints"
},
"mesonbuild.Swift-MesonLSP.others.muonPath": {
"mesonbuild.mesonlsp.others.removeDefaultTypesInInlayHints": {
"type": "boolean",
"default": false,
"description": "Reduce clutter in inlay hints by removing any|dict(any)|list(any)"
},
"mesonbuild.mesonlsp.others.disablePosargInlayHints": {
"type": "boolean",
"default": false,
"description": "Disable inlay hints for arguments"
},
"mesonbuild.mesonlsp.others.useCustomParser": {
"type": "boolean",
"default": true,
"description": "If true, a custom faster parser is used with better diagnostics, set to `false` it will fall back to the tree-sitter based parser"
},
"mesonbuild.mesonlsp.others.muonPath": {
"type": "string",
"default": null,
"description": "Set path to muon that will be used for formatting"
},
"mesonbuild.Swift-MesonLSP.linting.disableNameLinting": {
"mesonbuild.mesonlsp.linting.disableNameLinting": {
"type": "boolean",
"default": false,
"description": "Disable checking variable names for snake_case"
},
"mesonbuild.Swift-MesonLSP.linting.disableAllIdLinting": {
"mesonbuild.mesonlsp.linting.disableAllIdLinting": {
"type": "boolean",
"default": false,
"description": "Shortcut for all other `mesonbuild.Swift-MesonLSP.linting.disableXXXIdLinting` options"
"description": "Shortcut for all other `mesonbuild.mesonlsp.linting.disableXXXIdLinting` options"
},
"mesonbuild.Swift-MesonLSP.linting.disableCompilerIdLinting": {
"mesonbuild.mesonlsp.linting.disableCompilerIdLinting": {
"type": "boolean",
"default": false,
"description": "Disable checking whether a string literal is a known id, if comparing it with the result of `compiler.get_id()`"
},
"mesonbuild.Swift-MesonLSP.linting.disableCompilerArgumentIdLinting": {
"mesonbuild.mesonlsp.linting.disableCompilerArgumentIdLinting": {
"type": "boolean",
"default": false,
"description": "Disable checking whether a string literal is a known id, if comparing it with the result of `compiler.get_argument_syntax()`"
},
"mesonbuild.Swift-MesonLSP.linting.disableLinkerIdLinting": {
"mesonbuild.mesonlsp.linting.disableLinkerIdLinting": {
"type": "boolean",
"default": false,
"description": "Disable checking whether a string literal is a known id, if comparing it with the result of `compiler.get_linker_id()`"
},
"mesonbuild.Swift-MesonLSP.linting.disableCpuFamilyLinting": {
"mesonbuild.mesonlsp.linting.disableCpuFamilyLinting": {
"type": "boolean",
"default": false,
"description": "Disable checking whether a string literal is a known CPU family, if comparing it with the result of `XXX_machine.cpu_family()`"
},
"mesonbuild.Swift-MesonLSP.linting.disableOsFamilyLinting": {
"mesonbuild.mesonlsp.linting.disableOsFamilyLinting": {
"type": "boolean",
"default": false,
"description": "Disable checking whether a string literal is a known system, if comparing it with the result of `XXX_machine.system()`"
},
"mesonbuild.mesonlsp.linting.disableUnusedVariableCheck": {
"type": "boolean",
"default": false,
"description": "Disable checking whether a variable is unused"
},
"mesonbuild.mesonlsp.linting.disableArgTypeChecking": {
"type": "boolean",
"default": false,
"description": "Disable checking whether the types of arguments passed to a method or function are correct"
}
}
},
Expand Down
8 changes: 6 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ export async function activate(ctx: vscode.ExtensionContext) {

const server = extensionConfiguration(SettingsKey.languageServer);
let client = await createLanguageServerClient(server, await askShouldDownloadLanguageServer(), ctx);
if (client !== null && server == "Swift-MesonLSP") {
// Basically every server supports formatting...
const serverSupportsFormatting = server == "mesonlsp" || server == "Swift-MesonLSP";
if (client !== null && serverSupportsFormatting) {
ctx.subscriptions.push(
vscode.workspace.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(`mesonbuild.${server}`)) {
Expand All @@ -235,7 +237,9 @@ export async function activate(ctx: vscode.ExtensionContext) {
client.start();
await client.reloadConfig();

getOutputChannel().appendLine("Not enabling the muon linter/formatter because Swift-MesonLSP is active.");
getOutputChannel().appendLine(
"Not enabling the muon linter/formatter because a language server supporting formatting is active.",
);
} else {
activateLinters(sourceDir, ctx);
activateFormatters(sourceDir, ctx);
Expand Down
5 changes: 3 additions & 2 deletions src/lsp/common.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as vscode from "vscode";
import { LanguageServerClient } from ".";
import { LanguageServer } from "../types";
import { SwiftMesonLspLanguageClient } from "./swift-mesonlsp";
import { MesonLSPLanguageClient } from "./mesonlsp";
import { Uri } from "vscode";

export function serverToClass(server: LanguageServer): any {
switch (server) {
case "Swift-MesonLSP":
return SwiftMesonLspLanguageClient;
case "mesonlsp":
return MesonLSPLanguageClient;
default:
return null;
}
Expand Down
34 changes: 17 additions & 17 deletions src/lsp/swift-mesonlsp.ts → src/lsp/mesonlsp.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import * as os from "os";
import * as vscode from "vscode";

import { LanguageServerClient } from "../lsp";
import { Executable } from "vscode-languageclient/node";
import { LanguageServerClient } from "../lsp";

export class SwiftMesonLspLanguageClient extends LanguageServerClient {
export class MesonLSPLanguageClient extends LanguageServerClient {
private static artifacts: { [key: string]: { name: string; hash: string } } = {
"win32-x64": {
name: "Swift-MesonLSP-win64.zip",
hash: "393c4e7c1ed588e61940cdca5201e115e223727fcb578627b15e719b9783e08f",
name: "mesonlsp-x86_64-pc-windows-gnu.zip",
hash: "307078efdc91ead3bb86850c4438547dd94f98d2403937d9aab47d318421e866",
},
"darwin-x64": {
name: "Swift-MesonLSP-macos12.zip",
hash: "f94e0e51806e7630e94f9dee21240a94f0269f75ebbf44a5a72e064c50cd8155",
name: "mesonlsp-x86_64-apple-darwin.zip",
hash: "c93129b5a331e1ee29e2241e262564808ed523e43bc2b00d1512ff04ca9c77e7",
},
"darwin-arm64": {
name: "Swift-MesonLSP-macos12.zip",
hash: "f94e0e51806e7630e94f9dee21240a94f0269f75ebbf44a5a72e064c50cd8155",
name: "mesonlsp-aarch64-apple-darwin.zip",
hash: "12ec62cb5c2a852b9f99e2844fc350a22d62519d4aab1b757e99f116a0b84680",
},
"linux-x64": {
name: "Swift-MesonLSP.zip",
hash: "aef1f6b386e517ac31e58286b25c6bd828ad1fc1e6958a18d5cd52a868bdf1aa",
name: "mesonlsp-x86_64-unknown-linux-musl.zip",
hash: "055ab2d2fa0328c9d5c41f918b4a8c44b196232a1eef22384ef8073d81be945b",
},
};

static override repoURL: string = "https://github.com/JCWasmx86/Swift-MesonLSP";
static override setupURL: string = "https://github.com/JCWasmx86/Swift-MesonLSP/tree/main/Docs";
static override version: string = "3.1.3";
static override repoURL: string = "https://github.com/JCWasmx86/mesonlsp";
static override setupURL: string = "https://github.com/JCWasmx86/mesonlsp/tree/main/docs";
static override version: string = "4.1.8";

get runExe(): Executable {
return {
Expand All @@ -43,7 +43,7 @@ export class SwiftMesonLspLanguageClient extends LanguageServerClient {
}

constructor(languageServerPath: vscode.Uri, context: vscode.ExtensionContext, referenceVersion: string) {
super("Swift-MesonLSP", languageServerPath, context, referenceVersion);
super("mesonlsp", languageServerPath, context, referenceVersion);
}

static override artifact(): { url: string; hash: string } | null {
Expand All @@ -53,9 +53,9 @@ export class SwiftMesonLspLanguageClient extends LanguageServerClient {

if (arch !== "x64" && slug != "darwin-arm64") return null;

const artifact = SwiftMesonLspLanguageClient.artifacts[slug];
const artifact = MesonLSPLanguageClient.artifacts[slug];
return {
url: `${SwiftMesonLspLanguageClient.repoURL}/releases/download/v${SwiftMesonLspLanguageClient.version}/${artifact.name}`,
url: `${MesonLSPLanguageClient.repoURL}/releases/download/v${MesonLSPLanguageClient.version}/${artifact.name}`,
hash: artifact.hash,
};
}
Expand All @@ -67,7 +67,7 @@ export class SwiftMesonLspLanguageClient extends LanguageServerClient {
const platform = os.platform();
switch (platform) {
case "darwin":
// x64 and ARM are supported thanks to universal binaries.
// x64 and ARM are supported.
return true;
case "linux":
case "win32":
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type LinterConfiguration = {
enabled: boolean;
};

export type LanguageServer = "Swift-MesonLSP" | null;
export type LanguageServer = "Swift-MesonLSP" | "mesonlsp" | null;
export type ModifiableExtension = "ms-vscode.cpptools" | "rust-lang.rust-analyzer";

export interface ExtensionConfiguration {
Expand Down
Loading

0 comments on commit c6059b3

Please sign in to comment.