Skip to content

Commit

Permalink
Merge pull request #1144 from Yuki61803/master
Browse files Browse the repository at this point in the history
Add angular lsp support
  • Loading branch information
manateelazycat authored Jan 4, 2025
2 parents a8e5d67 + f024083 commit 11ceb1f
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ If your language supports mixed multi-language servers, it is recommended to che
|:------------|:---------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Ada | [ada_language_server](https://github.com/AdaCore/ada_language_server) | |
| Ansible | [ansible-language-server](https://github.com/ansible/ansible-language-server) | Ansible uses YAML as source code, you’ll need to customize `lsp-bridge-get-single-lang-server-by-project` to return "ansible-language-server". |
| Angular | [angular-language-server](https://github.com/angular/vscode-ng-language-service) | `npm i -g @angular/language-server @angular/language-service typescript emmet-ls vscode-langservers-extracted typescript-language-server` |
| Astro | [astro](https://github.com/withastro/language-tools/tree/main/packages/language-server) | `npm i -g @astrojs/language-server` |
| Ballerina | [ballerina-lang-server](https://github.com/ballerina-platform/ballerina-lang) | |
| Bash | [bash-language-server](https://github.com/bash-lsp/bash-language-server) | |
Expand Down
25 changes: 25 additions & 0 deletions langserver/angular-ls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "angular-ls",
"languageId": "angular",
"command": [
"ngserver",
"--ngProbeLocations",
"/usr/local/lib/node_modules",
"--tsProbeLocations",
"/usr/local/lib/node_modules",
"--tsdk",
"%TSDK_PATH%",
"--disableLetSyntax",
"false",
"--disableBlockSyntax",
"false",
"--includeCompletionsWithSnippetText",
"true",
"--forceStrictTemplates",
"true",
"--stdio"
],
"projectFiles": ["package.json"],
"settings": {},
"initializationOptions": {}
}
25 changes: 25 additions & 0 deletions langserver/angular-ls_windows.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "angular-ls",
"languageId": "angular",
"command": [
"ngserver",
"--ngProbeLocations",
"%USERPROFILE%\\AppData\\Roaming\\npm\\node_modules",
"--tsProbeLocations",
"%USERPROFILE%\\AppData\\Roaming\\npm\\node_modules",
"--tsdk",
"%USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\typescript\\lib",
"--disableLetSyntax",
"false",
"--disableBlockSyntax",
"false",
"--includeCompletionsWithSnippetText",
"true",
"--forceStrictTemplates",
"true",
"--stdio"
],
"projectFiles": ["package.json"],
"settings": {},
"initializationOptions": {}
}
4 changes: 3 additions & 1 deletion lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ Then LSP-Bridge will start by gdb, please send new issue with `*lsp-bridge*' buf
(("vue") . "volar_emmet")
(("ts") . "typescript_eslint")
(("tsx") . "typescriptreact_eslint")
(("component.html") . "angular_template_html")
(("component.ts") . "angular_template_typescript")
)
"The multi lang server rule for file extension."
:type 'cons)
Expand Down Expand Up @@ -1083,7 +1085,7 @@ So we build this macro to restore postion after code format."

(defun lsp-bridge-get-lang-server-by-extension (filename extension-list)
"Get lang server for file extension."
(when-let* ((file-extension (file-name-extension filename))
(when-let* ((file-extension (substring filename (+ (cl-position ?. filename) 1) (length filename)))
(langserver-info (cl-find-if
(lambda (pair)
(let ((extension (car pair)))
Expand Down
22 changes: 22 additions & 0 deletions multiserver/angular_template_html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"completion": ["vscode-html-language-server", "angular-ls", "emmet-ls"],
"completion_item_resolve": ["vscode-html-language-server", "angular-ls", "emmet-ls"],
"diagnostics": ["vscode-html-language-server", "angular-ls", "emmet-ls"],
"code_action": ["vscode-html-language-server", "angular-ls", "emmet-ls"],
"execute_command": ["vscode-html-language-server", "angular-ls", "emmet-ls"],
"find_define": "vscode-html-language-server",
"find_type_define": "vscode-html-language-server",
"find_implementation": "vscode-html-language-server",
"find_references": "vscode-html-language-server",
"peek_find_definition": "vscode-html-language-server",
"peek_find_references": "vscode-html-language-server",
"formatting": "vscode-html-language-server",
"hover": "vscode-html-language-server",
"signature_help": "vscode-html-language-server",
"prepare_rename": "vscode-html-language-server",
"rename": "vscode-html-language-server",
"document_symbol": "vscode-html-language-server",
"workspace_symbol": "vscode-html-language-server",
"semantic_tokens": "vscode-html-language-server",
"inlay_hint": "vscode-html-language-server"
}
22 changes: 22 additions & 0 deletions multiserver/angular_template_typescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"completion": ["typescript", "angular-ls"],
"completion_item_resolve": ["typescript", "angular-ls"],
"diagnostics": ["typescript", "angular-ls"],
"code_action": ["typescript", "angular-ls"],
"execute_command": ["typescript", "angular-ls"],
"find_define": "typescript",
"find_type_define": "typescript",
"find_implementation": "typescript",
"find_references": "typescript",
"peek_find_definition": "typescript",
"peek_find_references": "typescript",
"formatting": "typescript",
"hover": "typescript",
"signature_help": "typescript",
"prepare_rename": "typescript",
"rename": "typescript",
"document_symbol": "typescript",
"workspace_symbol": "typescript",
"semantic_tokens": "typescript",
"inlay_hint": "typescript"
}

0 comments on commit 11ceb1f

Please sign in to comment.