diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index a510638..7ce8d09 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -12,6 +12,17 @@ "name": "Jan Kott" }, "plugins": [ + { + "name": "astro-lsp", + "version": "1.0.0", + "source": "./astro_lsp", + "description": "Astro language server", + "category": "development", + "tags": ["astro", "lsp"], + "author": { + "name": "synxn1o" + } + }, { "name": "bash-language-server", "version": "1.0.0", diff --git a/astro_lsp/.claude-plugin/plugin.json b/astro_lsp/.claude-plugin/plugin.json new file mode 100644 index 0000000..e8ab923 --- /dev/null +++ b/astro_lsp/.claude-plugin/plugin.json @@ -0,0 +1,9 @@ +{ + "name": "astro-lsp", + "description": "Astro language server for .astro files", + "version": "1.0.0", + "author": { + "name": "synxn1o" + }, + "license": "MIT" +} diff --git a/astro_lsp/.lsp.json b/astro_lsp/.lsp.json new file mode 100644 index 0000000..3162fda --- /dev/null +++ b/astro_lsp/.lsp.json @@ -0,0 +1,14 @@ +{ + "astro": { + "command": "astro-ls", + "args": ["--stdio"], + "extensionToLanguage": { + ".astro": "astro" + }, + "initializationOptions": { + "typescript": { + "tsdk": "node_modules/typescript/lib" + } + } + } +} diff --git a/astro_lsp/README.md b/astro_lsp/README.md new file mode 100644 index 0000000..6e0f275 --- /dev/null +++ b/astro_lsp/README.md @@ -0,0 +1,40 @@ +# astro-lsp + +Astro language server for Claude Code, providing code intelligence features for `.astro` files. + +## Supported Extensions +`.astro` + +## Installation + +Install the Astro language server globally via npm: + +```bash +npm install -g @astrojs/language-server +``` + +Or with yarn: + +```bash +yarn global add @astrojs/language-server +``` + +## Usage + +1. Install the plugin in Claude Code: + ``` + /plugin install astro-lsp@claude-code-lsps + ``` + +2. Open any `.astro` file in Claude Code + +3. The Astro language server will automatically start and provide: + - Diagnostics (errors, warnings) + - Completions + - Hover information + - Go-to-definition + - Find references + +## More Information +- [@astrojs/language-server on npm](https://www.npmjs.com/package/@astrojs/language-server) +- [GitHub Repository](https://github.com/withastro/astro/tree/main/packages/language-tools/language-server) diff --git a/astro_lsp/hooks/check-astro-ls.sh b/astro_lsp/hooks/check-astro-ls.sh new file mode 100644 index 0000000..812e786 --- /dev/null +++ b/astro_lsp/hooks/check-astro-ls.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Check if astro-ls is installed and available in PATH + +if command -v astro-ls &> /dev/null; then + exit 0 +fi + +# Check if npm is available +if ! command -v npm &> /dev/null; then + echo "[astro-ls] npm is not installed. Please install Node.js first from https://nodejs.org/" + echo " Then run: npm install -g @astrojs/language-server" + exit 0 +fi + +# npm is installed but astro-ls is not - install it +echo "[astro-ls] Installing @astrojs/language-server..." +npm install -g @astrojs/language-server + +if command -v astro-ls &> /dev/null; then + echo "[astro-ls] Installed successfully" +else + echo "[astro-ls] Failed to install. Please run manually:" + echo " npm install -g @astrojs/language-server" +fi + +exit 0 diff --git a/astro_lsp/hooks/hooks.json b/astro_lsp/hooks/hooks.json new file mode 100644 index 0000000..73bfd37 --- /dev/null +++ b/astro_lsp/hooks/hooks.json @@ -0,0 +1,16 @@ +{ + "description": "Check for astro-ls installation on session start", + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/check-astro-ls.sh", + "timeout": 30 + } + ] + } + ] + } +}