summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-05-08 11:35:20 -0400
committerGravatar GitHub <noreply@github.com> 2021-05-08 11:35:20 -0400
commit60e482aa809fd89c865bfb5ec95b97a739235615 (patch)
tree559f2d84d98b833712ad7ca969d0ba7ae2e1f506 /tools
parentb4c072d1a13902c90294bebf320fd1cb9550ba0e (diff)
downloadastro-60e482aa809fd89c865bfb5ec95b97a739235615.tar.gz
astro-60e482aa809fd89c865bfb5ec95b97a739235615.tar.zst
astro-60e482aa809fd89c865bfb5ec95b97a739235615.zip
Fix running the extension (#181)
I'm not sure how my setup was different but I was unable to get the extension to run locally without adding a binary. This mirrors what Svelte does so I'm assuming it's the way it's supposed to be loaded.
Diffstat (limited to 'tools')
-rw-r--r--tools/astro-languageserver/bin/server.js6
-rw-r--r--tools/astro-languageserver/tsconfig.json3
-rw-r--r--tools/astro-vscode/contributing.md20
-rw-r--r--tools/astro-vscode/src/index.ts4
4 files changed, 31 insertions, 2 deletions
diff --git a/tools/astro-languageserver/bin/server.js b/tools/astro-languageserver/bin/server.js
new file mode 100644
index 000000000..1967fff94
--- /dev/null
+++ b/tools/astro-languageserver/bin/server.js
@@ -0,0 +1,6 @@
+#! /usr/bin/env node
+
+// eslint-disable-next-line @typescript-eslint/no-var-requires
+const { startServer } = require('../dist/index');
+
+startServer(); \ No newline at end of file
diff --git a/tools/astro-languageserver/tsconfig.json b/tools/astro-languageserver/tsconfig.json
index 7b2ff1ea2..b20132ea6 100644
--- a/tools/astro-languageserver/tsconfig.json
+++ b/tools/astro-languageserver/tsconfig.json
@@ -2,7 +2,8 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
- "rootDir": "src"
+ "rootDir": "src",
+ "target": "ES2020"
},
"include": ["src"],
"exclude": ["node_modules"]
diff --git a/tools/astro-vscode/contributing.md b/tools/astro-vscode/contributing.md
new file mode 100644
index 000000000..d9f1bd59e
--- /dev/null
+++ b/tools/astro-vscode/contributing.md
@@ -0,0 +1,20 @@
+# Contributing
+
+## Development workflow
+
+In the monorepo first install and build Astro:
+
+```shell
+yarn install
+yarn build
+```
+
+To start the development server run:
+
+```shell
+yarn dev:vscode
+```
+
+Then in the __Debug__ panel select __Launch Extension__ from the dropdown and click the run button.
+
+<img width="558" alt="Screen Shot 2021-05-07 at 8 51 37 AM" src="https://user-images.githubusercontent.com/361671/117452223-807e5580-af11-11eb-8404-dd615784408a.png">
diff --git a/tools/astro-vscode/src/index.ts b/tools/astro-vscode/src/index.ts
index 672a074d0..d48f2723c 100644
--- a/tools/astro-vscode/src/index.ts
+++ b/tools/astro-vscode/src/index.ts
@@ -17,7 +17,7 @@ export async function activate(context: vscode.ExtensionContext) {
/** */
function createLanguageService(context: vscode.ExtensionContext, mode: 'doc', id: string, name: string, port: number) {
const { workspace } = vscode;
- const serverModule = context.asAbsolutePath(require.resolve('astro-languageserver'));
+ const serverModule = require.resolve('astro-languageserver/bin/server.js');
const debugOptions = { execArgv: ['--nolazy', '--inspect=' + port] };
const serverOptions: lsp.ServerOptions = {
run: { module: 'astro-languageserver', transport: lsp.TransportKind.ipc },
@@ -60,6 +60,8 @@ function createLanguageService(context: vscode.ExtensionContext, mode: 'doc', id
};
const disposable = activateTagClosing(tagRequestor, { astro: true }, 'html.autoClosingTags');
context.subscriptions.push(disposable);
+ }).catch(err => {
+ console.error('Astro, unable to load language server.', err);
});
return client;