diff --git a/pydance/package.json b/pydance/package.json index 59a9e93..f65d9f4 100644 --- a/pydance/package.json +++ b/pydance/package.json @@ -31,7 +31,18 @@ ".py" ] } - ] + ], + "configuration": { + "title": "Pydance", + "properties": { + "pydance.parser": { + "type": "string", + "default": "ruff", + "enum": ["ruff", "tree-sitter"], + "description": "Parser backend to use for Python code analysis" + } + } + } }, "scripts": { "vscode:prepublish": "npm run compile", diff --git a/pydance/src/extension.ts b/pydance/src/extension.ts index 0c2dbc2..ba39314 100644 --- a/pydance/src/extension.ts +++ b/pydance/src/extension.ts @@ -16,10 +16,14 @@ export function activate(context: vscode.ExtensionContext) { const serverPath = context.asAbsolutePath(path.join("pylight")); outputChannel.appendLine(`Server path: ${serverPath}`); + // Get the parser configuration + const config = vscode.workspace.getConfiguration("pydance"); + const parser = config.get("parser", "ruff"); + outputChannel.appendLine(`Using parser: ${parser}`); // If the extension is launched in debug mode then the debug server options are used const serverOptions: ServerOptions = { - run: { command: serverPath, args: [] }, - debug: { command: serverPath, args: [] }, + run: { command: serverPath, args: ["--parser", parser] }, + debug: { command: serverPath, args: ["--parser", parser] }, }; // Options to control the language client