diff --git a/README.md b/README.md index 9653db759f..9857a7c1d9 100644 --- a/README.md +++ b/README.md @@ -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) | | diff --git a/langserver/angular-ls.json b/langserver/angular-ls.json new file mode 100644 index 0000000000..f7650aa1f7 --- /dev/null +++ b/langserver/angular-ls.json @@ -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": {} +} diff --git a/langserver/angular-ls_windows.json b/langserver/angular-ls_windows.json new file mode 100644 index 0000000000..d1368db0f7 --- /dev/null +++ b/langserver/angular-ls_windows.json @@ -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": {} +} diff --git a/lsp-bridge.el b/lsp-bridge.el index e6e9321bd1..b471d6c1c1 100644 --- a/lsp-bridge.el +++ b/lsp-bridge.el @@ -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) @@ -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))) diff --git a/multiserver/angular_template_html.json b/multiserver/angular_template_html.json new file mode 100644 index 0000000000..375d82acaf --- /dev/null +++ b/multiserver/angular_template_html.json @@ -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" +} diff --git a/multiserver/angular_template_typescript.json b/multiserver/angular_template_typescript.json new file mode 100644 index 0000000000..676c1d47c2 --- /dev/null +++ b/multiserver/angular_template_typescript.json @@ -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" +}