Skip to content

Commit

Permalink
Split out astro-languageserver and astro-vscode (withastro#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored May 5, 2021
1 parent 0fe0a6b commit 64f4f74
Show file tree
Hide file tree
Showing 45 changed files with 323 additions and 200 deletions.
10 changes: 5 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"type": "pwa-extensionHost",
"request": "launch",
"name": "Launch Client",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}/vscode"],
"outFiles": ["${workspaceRoot}/vscode/dist/**/*.js"],
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"outFiles": ["${workspaceRoot}/tools/astro-vscode/dist/**/*.js"],
"preLaunchTask": {
"type": "npm",
"script": "build:extension"
"script": "build:vscode"
}
},
{
Expand All @@ -20,7 +20,7 @@
"name": "Attach to Server",
"port": 6040,
"restart": true,
"outFiles": ["${workspaceRoot}/vscode/dist/**/*.js"]
"outFiles": ["${workspaceRoot}/tools/astro-languageserver/dist/**/*.js"]
}
],
"compounds": [
Expand Down
5 changes: 2 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
"tasks": [
{
"type": "npm",
"script": "build:extension",
"script": "build:vscode",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": ["$tsc"]
}
}
]
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "root",
"version": "0.0.0",
"private": true,
"scripts": {
"release": "yarn build && yarn changeset publish",
"build": "yarn build:core",
"build:core": "lerna run build --scope astro --scope astro-parser --scope create-astro",
"build:vscode": "lerna run build --scope astro-languageserver --scope astro-vscode",
"dev:vscode": "lerna run dev --scope astro-languageserver --scope astro-vscode --parallel --stream",
"format": "prettier -w '**/*.{js,jsx,ts,tsx,md,json}'",
"lint": "eslint 'packages/**/*.ts'",
"test": "yarn test:core && yarn test:prettier",
Expand All @@ -18,6 +21,9 @@
"scripts",
"www"
],
"engines": {
"vscode": "^1.22.0"
},
"volta": {
"node": "14.16.1",
"npm": "7.11.2",
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions tools/astro-languageserver/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "astro-languageserver",
"version": "0.3.0",
"author": "Skypack",
"license": "MIT",
"type": "commonjs",
"main": "dist/index.js",
"types": "types/index.d.ts",
"files": [
"dist",
"types"
],
"scripts": {
"build": "astro-scripts build 'src/index.ts'",
"dev": "astro-scripts dev 'src/index.ts'"
},
"devDependencies": {
"astro": "0.0.9",
"astro-scripts": "0.0.1"
},
"dependencies": {
"vscode-emmet-helper": "2.1.2",
"vscode-html-languageservice": "^3.0.3",
"vscode-languageserver": "6.1.1",
"vscode-languageserver-textdocument": "^1.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { urlToPath } from './utils';

const TagCloseRequest: RequestType<TextDocumentPositionParams, string | null, any> = new RequestType('html/tag');

/** */
/**
* Starts `astro-languageservice`
*/
export function startServer() {
let connection = createConnection(ProposedFeatures.all);

Expand Down Expand Up @@ -102,5 +104,3 @@ export function startServer() {

connection.listen();
}

startServer();
4 changes: 4 additions & 0 deletions tools/astro-languageserver/src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Starts `astro-languageservice`
*/
export function startServer(): void {}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
22 changes: 12 additions & 10 deletions tools/vscode/package.json → tools/astro-vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@astro.build/vscode",
"name": "astro-vscode",
"displayName": "Astro",
"description": "Language support for Astro",
"icon": "assets/icon.png",
"type": "commonjs",
"galleryBanner": {
"color": "#FF5D01",
"theme": "dark"
Expand All @@ -12,25 +13,26 @@
"publisher": "astro-build",
"license": "MIT",
"scripts": {
"vscode:prepublish": "npm run build",
"bootstrap": "cd packages/client && yarn && cd ../server && yarn",
"build": "node scripts/build.mjs",
"watch": "node scripts/watch.mjs"
"vscode:prepublish": "yarn build",
"build": "astro-scripts build 'src/index.ts'",
"dev": "astro-scripts dev 'src/index.ts'"
},
"engines": {
"vscode": "^1.52.0"
"vscode": "^1.22.0"
},
"activationEvents": [
"onLanguage:astro"
],
"dependencies": {
"vscode": "^1.1.37",
"vscode-languageclient": "~7.0.0",
"vscode-html-languageservice": "^3.0.3",
"vscode-emmet-helper": "2.1.2"
"vscode-emmet-helper": "2.1.2",
"astro-languageserver": "0.3.0"
},
"devDependencies": {
"esbuild": "0.10.0",
"@astro-vscode/client": "file:./packages/client",
"@astro-vscode/server": "file:./packages/server"
"astro-scripts": "0.0.1",
"@types/vscode": "latest"
},
"main": "./dist/index.js",
"files": [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ 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(path.join('dist', 'server.js'));
const serverModule = context.asAbsolutePath(require.resolve('astro-languageserver'));
const debugOptions = { execArgv: ['--nolazy', '--inspect=' + port] };
const serverOptions: lsp.ServerOptions = {
run: { module: serverModule, transport: lsp.TransportKind.ipc },
run: { module: 'astro-languageserver', transport: lsp.TransportKind.ipc },
debug: {
module: serverModule,
transport: lsp.TransportKind.ipc,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"rootDir": "src"
},
"include": ["src"],
"exclude": ["node_modules"],
"references": [{ "path": "../server" }]
"exclude": ["node_modules"]
}
12 changes: 0 additions & 12 deletions tools/vscode/packages/client/package.json

This file was deleted.

22 changes: 0 additions & 22 deletions tools/vscode/packages/server/package.json

This file was deleted.

37 changes: 0 additions & 37 deletions tools/vscode/scripts/build.mjs

This file was deleted.

7 changes: 0 additions & 7 deletions tools/vscode/scripts/esbuild.config.mjs

This file was deleted.

27 changes: 0 additions & 27 deletions tools/vscode/scripts/watch.mjs

This file was deleted.

13 changes: 0 additions & 13 deletions tools/vscode/tsconfig.json

This file was deleted.

Loading

0 comments on commit 64f4f74

Please sign in to comment.