feat(cli): add VS Code extension wrapping glint lsp
editors/vscode/ is a TypeScript VS Code extension that starts glint lsp as a child process and connects to it via vscode-languageclient. The documentSelector restricts LSP processing to **/.gitlab-ci.yml so other YAML files are unaffected. The glint.executablePath setting controls the binary location (default: glint on PATH). Build with task ext-compile; package as .vsix with task ext-package. Taskfile tasks added: ext-install, ext-compile, ext-package. Root .gitignore updated to exclude node_modules/, out/, and *.vsix from the extension directory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
out/
|
||||
*.vsix
|
||||
@@ -0,0 +1,8 @@
|
||||
src/**
|
||||
tsconfig.json
|
||||
.gitignore
|
||||
node_modules/**
|
||||
!node_modules/vscode-languageclient/**
|
||||
!node_modules/vscode-languageserver-protocol/**
|
||||
!node_modules/vscode-languageserver-types/**
|
||||
!node_modules/vscode-jsonrpc/**
|
||||
Generated
+2532
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "glint",
|
||||
"displayName": "glint — GitLab CI Linter",
|
||||
"description": "Inline diagnostics for .gitlab-ci.yml pipelines powered by the glint language server",
|
||||
"version": "0.2.29",
|
||||
"publisher": "k3nny",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.k3nny.fr/k3nny/glint"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.82.0"
|
||||
},
|
||||
"categories": [
|
||||
"Linters"
|
||||
],
|
||||
"keywords": [
|
||||
"gitlab",
|
||||
"ci",
|
||||
"yaml",
|
||||
"lint",
|
||||
"pipeline"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onLanguage:yaml"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "glint",
|
||||
"properties": {
|
||||
"glint.executablePath": {
|
||||
"type": "string",
|
||||
"default": "glint",
|
||||
"markdownDescription": "Path to the `glint` binary. Leave as `glint` if it is on your `PATH`, or set an absolute path (e.g. `/usr/local/bin/glint`)."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc --watch -p ./",
|
||||
"package": "vsce package"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
"@types/vscode": "^1.82.0",
|
||||
"@vscode/vsce": "^2.22.0",
|
||||
"typescript": "^5.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import * as vscode from 'vscode';
|
||||
import {
|
||||
LanguageClient,
|
||||
LanguageClientOptions,
|
||||
ServerOptions,
|
||||
TransportKind,
|
||||
} from 'vscode-languageclient/node';
|
||||
|
||||
let client: LanguageClient | undefined;
|
||||
|
||||
export function activate(context: vscode.ExtensionContext): void {
|
||||
const cfg = vscode.workspace.getConfiguration('glint');
|
||||
const glintPath = cfg.get<string>('executablePath') || 'glint';
|
||||
|
||||
const serverOptions: ServerOptions = {
|
||||
command: glintPath,
|
||||
args: ['lsp'],
|
||||
transport: TransportKind.stdio,
|
||||
};
|
||||
|
||||
const clientOptions: LanguageClientOptions = {
|
||||
// Only process .gitlab-ci.yml files, not all YAML.
|
||||
documentSelector: [
|
||||
{ scheme: 'file', language: 'yaml', pattern: '**/.gitlab-ci.yml' },
|
||||
],
|
||||
};
|
||||
|
||||
client = new LanguageClient(
|
||||
'glint',
|
||||
'glint — GitLab CI Linter',
|
||||
serverOptions,
|
||||
clientOptions,
|
||||
);
|
||||
|
||||
client.start();
|
||||
context.subscriptions.push(client);
|
||||
}
|
||||
|
||||
export async function deactivate(): Promise<void> {
|
||||
await client?.stop();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "ES2020",
|
||||
"lib": ["ES2020"],
|
||||
"outDir": "out",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "out"]
|
||||
}
|
||||
Reference in New Issue
Block a user