-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: DLT-1812 language server - initial implementation #551
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a4098b8
language server initial implementation
juliodialpad c9ff5bc
add pack command
juliodialpad 6b54ccc
add CSS Variable resolver
juliodialpad 82001b7
add test css file
juliodialpad c01b41d
add docs
juliodialpad 434b019
multiple enhancements
juliodialpad 8ac1fe7
update docs
juliodialpad f087623
update versions
juliodialpad 2baf396
update versions
juliodialpad 98a662f
update vscode engine
juliodialpad 7fdb8a1
fix typo
juliodialpad 2084546
fix invalid version
juliodialpad 5ef3fbc
Merge branch 'staging' into feat/language-server
juliodialpad 345e45c
update pnpm-lock
juliodialpad 78905b6
cleanup
juliodialpad d0c8a89
merge staging
juliodialpad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"name": "Root", | ||
"path": "../" | ||
}, | ||
{ | ||
"name": "Documentation", | ||
"path": "../apps/dialtone-documentation" | ||
}, | ||
{ | ||
"name": "CSS", | ||
"path": "../packages/dialtone-css" | ||
}, | ||
{ | ||
"name": "Emojis", | ||
"path": "../packages/dialtone-emojis" | ||
}, | ||
{ | ||
"name": "Icons", | ||
"path": "../packages/dialtone-icons" | ||
}, | ||
{ | ||
"name": "Tokens", | ||
"path": "../packages/dialtone-tokens" | ||
}, | ||
{ | ||
"name": "Vue 2", | ||
"path": "../packages/dialtone-vue2" | ||
}, | ||
{ | ||
"name": "Vue 3", | ||
"path": "../packages/dialtone-vue3" | ||
}, | ||
{ | ||
"name": "ESLint Plugin", | ||
"path": "../packages/eslint-plugin-dialtone" | ||
}, | ||
{ | ||
"name": "StyleLint Plugin", | ||
"path": "../packages/stylelint-plugin-dialtone" | ||
}, | ||
], | ||
"settings": { | ||
"eslint.format.enable": true, | ||
"eslint.run": "onSave", | ||
"eslint.runtime": "node", | ||
"stylelint.enable": true, | ||
"stylelint.stylelintPath": "node_modules/stylelint/lib/index.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "apps/dialtone-css" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Client", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--disable-updates", | ||
"--disable-workspace-trust", | ||
"--profile-temp", | ||
"--skip-release-notes", | ||
"--skip-welcome", | ||
"--extensionDevelopmentPath=${workspaceRoot}/packages/language-server/vscode", | ||
"--folder-uri=${workspaceRoot}/packages/language-server/sample" | ||
], | ||
"outFiles": ["${workspaceRoot}/packages/language-server/vscode/dist/*.js"], | ||
"preLaunchTask": "watch: language-server" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"name": "@dialpad/dialtone-icons-vue2", | ||
"devDependencies": { | ||
"vue": "^2.7.16" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"name": "@dialpad/dialtone-icons-vue3", | ||
"devDependencies": { | ||
"@vue/compiler-sfc": "^3.4.15", | ||
"vue": "^3.4.15" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Dialtone language-tools | ||
|
||
This is the Dialtone language tools based on Volar Framework. | ||
|
||
## Tools | ||
|
||
- pnpm: monorepo support | ||
- esbuild: bundle extension | ||
|
||
## Folder structure | ||
|
||
- server: Language server. | ||
- src: Language server source files. | ||
- resolvers: Process documentation and return completion items array. | ||
- services: Language service plugins | ||
- vscode: VSCode extension. | ||
- src: Extension source files. | ||
- scripts: ESBuild script. | ||
- sample: Test files | ||
|
||
## Running the Sample | ||
|
||
- Run `pnpm install`. This installs all necessary npm modules in both the client and server folder | ||
- Open VS Code on this folder. | ||
- Switch to the Debug viewlet. | ||
- Select `Launch Client` from the drop down. | ||
- Run the launch config. | ||
- In the [Extension Development Host] instance of VSCode, open a `test.vue` | ||
- Type `<dt-|` to try Component completion. | ||
- Type `<dt-avatar | />` to try property completion. | ||
- Have `<dt-avatar size="|" />` to see values completion. | ||
|
||
## Build .vsix | ||
|
||
- Run `pnpm nx run dialtone-language-server:pack` in this folder | ||
- `vscode/vscode-dialtone-X.X.X.vsix` will be created, and you can manual install it to VSCode. | ||
|
||
## References | ||
|
||
- <https://code.visualstudio.com/api/language-extensions/embedded-languages> | ||
- <https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-embedded-language-service> | ||
- <https://volarjs.dev/core-concepts/why-volar/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "dialtone-language-server", | ||
"targets": { | ||
"build": { | ||
"executor": "nx:run-commands", | ||
"dependsOn": [ | ||
"dialtone-vue3:build", | ||
"dialtone-tokens:build" | ||
], | ||
"inputs": [ | ||
"{projectRoot}/**/*" | ||
], | ||
"outputs": [ "{projectRoot}/vscode/dist" ], | ||
"options": { | ||
"cwd": "{projectRoot}/vscode", | ||
"command": "pnpm run build" | ||
} | ||
}, | ||
"publish": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "pnpm publish --filter ./packages/dialtone-vue2" | ||
} | ||
}, | ||
"pack": { | ||
"executor": "nx:run-commands", | ||
"dependsOn": [ | ||
"build", | ||
"dialtone-vue3:build", | ||
"dialtone-tokens:build" | ||
], | ||
"options": { | ||
"cwd": "{projectRoot}/vscode", | ||
"command": "pnpm vsce package --pre-release" | ||
} | ||
}, | ||
"release": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "pnpm semantic-release-plus --extends ./packages/dialtone-vue2/release-ci.config.cjs && sleep 3", | ||
"parallel": false | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<dt-avatar /> | ||
<dt-avatar size="" /> | ||
</template> | ||
|
||
<style> | ||
.custom-class { | ||
color: var(--dt-); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.custom-color { | ||
color: var() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Dialtone language server | ||
|
||
Language server based on Volar Framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env node | ||
if (process.argv.includes('--version')) { | ||
const pkgJSON = require('../package.json'); | ||
console.log(`${pkgJSON.version}`); | ||
} else { | ||
require('../out/index.js'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "@dialpad/dialtone-language-server", | ||
"version": "1.0.0-alpha.2", | ||
"author": "Tico Ortega <julio.ortega@dialpad.com>", | ||
"bugs": { | ||
"email": "dialtone@dialpad.com" | ||
}, | ||
"license": "MIT", | ||
"main": "out/index.js", | ||
"files": [ | ||
"out/**/*.js", | ||
"out/**/*.d.ts" | ||
], | ||
"bin": { | ||
"dialtone-ls": "bin/server.js" | ||
}, | ||
"dependencies": { | ||
"@volar/language-core": "~2.4.8", | ||
"@volar/language-server": "~2.4.8", | ||
"@volar/language-service": "~2.4.8", | ||
"vscode-html-languageservice": "~5.3.1", | ||
"vscode-uri": "~3.0.8" | ||
}, | ||
"devDependencies": { | ||
"@dialpad/dialtone-vue": "workspace:^3", | ||
"@dialpad/dialtone-tokens": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createConnection, createServer, createSimpleProject } from '@volar/language-server/node'; | ||
import { create as createDialtoneComponentsService } from './services/dialtone-components'; | ||
import { create as createDialtoneTokensService } from './services/dialtone-tokens'; | ||
import { dialtoneLanguagePlugin } from "./language-plugin"; | ||
|
||
const connection = createConnection(); | ||
const server = createServer(connection); | ||
|
||
connection.listen(); | ||
|
||
connection.onInitialize((params) => { | ||
return server.initialize( | ||
params, | ||
createSimpleProject([dialtoneLanguagePlugin]), | ||
[ | ||
createDialtoneComponentsService(), | ||
createDialtoneTokensService(), | ||
] | ||
); | ||
}); | ||
|
||
connection.onInitialized(server.initialized); | ||
|
||
connection.onShutdown(server.shutdown); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This for volar development?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes