├── .gitattributes
├── test
├── fixtures
│ ├── SampleFlowProject
│ │ ├── .flowconfig
│ │ └── src
│ │ │ ├── sample-without-flow-comment.js
│ │ │ └── sample.js
│ ├── org-mode
│ │ ├── org_demo_file_2.py
│ │ ├── demo.cpp
│ │ ├── demo2.cpp
│ │ ├── org_demo_file.py
│ │ ├── java-project
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ └── java
│ │ │ │ │ │ └── temp
│ │ │ │ │ │ └── App.java
│ │ │ │ └── test
│ │ │ │ │ └── java
│ │ │ │ │ └── temp
│ │ │ │ │ └── AppTest.java
│ │ │ └── pom.xml
│ │ └── demo.org
│ ├── SampleJsProject
│ │ └── src
│ │ │ └── sample.js
│ ├── pyls
│ │ └── test.py
│ └── SampleTypeScriptProject
│ │ └── src
│ │ └── sample.ts
├── test-helper.el
├── windows-bootstrap.el
├── lsp-benchmarks.el
├── lsp-clangd-test.el
├── lsp-completion-test.el
└── lsp-javascript-test.el
├── .github
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ ├── question.md
│ └── bug_report.md
├── labeler.yml
├── workflows
│ ├── labeler.yml
│ ├── docs.yml
│ └── test.yml
└── FUNDING.yml
├── examples
├── eldoc.png
├── head.png
├── logo.png
├── rename.gif
├── describe.png
├── goto-def.gif
├── imenu-1.png
├── imenu-2.png
├── org-mode.gif
├── code-lens.png
├── completion.gif
├── completion.png
├── debugging.png
├── formatting.gif
├── helm-imenu.gif
├── logo-mini.png
├── references.png
├── which-key.png
├── metals-doctor.png
├── sym_highlight.gif
├── find-definition.gif
├── find-references.gif
├── python_debugging.png
├── references-lsp-ui.png
├── symbol-highlights.gif
├── call-hierarchy-ccls.png
├── modeline-diagnostics.png
├── lsp-dart-flutter-debug.gif
├── lsp-rust-analyzer-status.png
├── lsp-rust-join-lines-after.png
├── lsp-rust-join-lines-before.png
├── lsp-rust-macro-expansion.png
├── modeline-code-actions-icon.png
├── clangd_semantic_highlighting.png
├── clangd-clang-tidy-integration.png
├── headerline-breadcrumb-symbols.png
├── lsp-rust-analyzer-auto-import.png
├── lsp-rust-analyzer-inlay-hints.png
├── lsp-rust-analyzer-syntax-tree.png
├── modeline-code-actions-name-icon.png
├── modeline-code-actions-count-icon.png
├── modeline-code-actions-count-icon-name.png
├── headerline-breadcrumb-project-file-symbols.png
└── headerline-breadcrumb-path-up-to-project-file-symbols.png
├── refcard
├── lsp-refcard.pdf
├── README.md
└── lsp-refcard.tex
├── docs
├── tutorials
│ ├── images
│ │ ├── debug.png
│ │ ├── mouse.png
│ │ ├── completion.png
│ │ ├── hover-info.png
│ │ ├── turn-off-1.png
│ │ ├── turn-off-2.png
│ │ ├── turn-off-3.png
│ │ ├── turn-off-4.png
│ │ ├── which-key.png
│ │ ├── errors-list.png
│ │ ├── clojure-rename.gif
│ │ ├── import-project.png
│ │ ├── references-helm.png
│ │ ├── select-template.png
│ │ ├── signature-help.png
│ │ ├── clojure-clean-ns.gif
│ │ ├── clojure-code-lens.png
│ │ ├── clojure-completion.png
│ │ ├── clojure-formatting.gif
│ │ ├── reactjs
│ │ │ ├── breakpoint.png
│ │ │ ├── js-error.png
│ │ │ ├── hello-world.png
│ │ │ ├── intellisense.png
│ │ │ ├── suggestions.png
│ │ │ ├── app-is-unused.png
│ │ │ ├── debug-variable.png
│ │ │ ├── hit-breakpoint.png
│ │ │ ├── import-project.png
│ │ │ ├── install-server.png
│ │ │ ├── parameter-help.png
│ │ │ ├── bracket-matching.png
│ │ │ ├── extra-semi-error.png
│ │ │ ├── welcome-to-react.png
│ │ │ ├── debugger-for-chrome.png
│ │ │ └── chrome-debugger-readme.png
│ │ ├── workspace-symbols.png
│ │ ├── treemacs-references.png
│ │ ├── clojure-add-missing-ns.gif
│ │ ├── clojure-call-hierarchy.png
│ │ ├── clojure-find-references.gif
│ │ ├── clojure-import-project.png
│ │ ├── clojure-syntax-checker.png
│ │ ├── lsp-treemacs-references.png
│ │ ├── clojure-semantic-tokens-off.png
│ │ ├── clojure-semantic-tokens-on.png
│ │ └── clojure-semantic-tokens-cider.png
│ └── how-to-turn-off.md
├── template
│ ├── lsp-client-var.md
│ └── lsp-client.md
├── Cask
├── Makefile
├── page
│ ├── languages.md
│ ├── limitations.md
│ ├── gallery.md
│ ├── troubleshooting.md
│ ├── remote.md
│ ├── faq.md
│ ├── adding-new-language.md
│ ├── settings.md
│ ├── main-features.md
│ ├── performance.md
│ └── installation.md
├── stylesheets
│ ├── members.css
│ └── layout.css
├── manual-language-docs
│ ├── lsp-sqls.md
│ ├── lsp-latex.md
│ ├── lsp-org.md
│ └── lsp-rust.md
└── js
│ └── expanded_nav.js
├── features
├── support
│ ├── projects
│ │ └── pyls
│ │ │ └── test.py
│ └── env.el
├── lsp.feature
└── step-definitions
│ └── lsp-mode-steps.el
├── lsp.el
├── Cask
├── .gitignore
├── AUTHORS
├── .git-blame-ignore-revs
├── scripts
├── lsp-vscode-snippets.el
├── lsp-start-plain.el
├── lsp-generate-bindings.el
└── lsp-generate-settings.el
├── clients
├── lsp-nim.el
├── lsp-dhall.el
├── lsp-cmake.el
├── lsp-r.el
├── lsp-nix.el
├── lsp-crystal.el
├── lsp-vala.el
├── lsp-prolog.el
├── lsp-sorbet.el
├── lsp-hack.el
├── lsp-verilog.el
├── lsp-fortran.el
├── lsp-steep.el
├── lsp-terraform.el
├── lsp-gdscript.el
├── lsp-erlang.el
├── lsp-groovy.el
├── lsp-tex.el
├── lsp-purescript.el
├── lsp-dockerfile.el
├── lsp-ada.el
├── lsp-racket.el
├── lsp-ocaml.el
├── lsp-angular.el
├── lsp-bash.el
├── lsp-vimscript.el
├── lsp-perl.el
├── lsp-elm.el
├── lsp-kotlin.el
├── lsp-json.el
└── lsp-vhdl.el
├── CONTRIBUTING.md
├── lsp-iedit.el
├── Makefile
├── CODE_OF_CONDUCT.md
└── lsp-icons.el
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/test/fixtures/SampleFlowProject/.flowconfig:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | Describe your feature here.
2 |
--------------------------------------------------------------------------------
/examples/eldoc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/eldoc.png
--------------------------------------------------------------------------------
/examples/head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/head.png
--------------------------------------------------------------------------------
/examples/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/logo.png
--------------------------------------------------------------------------------
/examples/rename.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/rename.gif
--------------------------------------------------------------------------------
/examples/describe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/describe.png
--------------------------------------------------------------------------------
/examples/goto-def.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/goto-def.gif
--------------------------------------------------------------------------------
/examples/imenu-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/imenu-1.png
--------------------------------------------------------------------------------
/examples/imenu-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/imenu-2.png
--------------------------------------------------------------------------------
/examples/org-mode.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/org-mode.gif
--------------------------------------------------------------------------------
/examples/code-lens.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/code-lens.png
--------------------------------------------------------------------------------
/examples/completion.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/completion.gif
--------------------------------------------------------------------------------
/examples/completion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/completion.png
--------------------------------------------------------------------------------
/examples/debugging.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/debugging.png
--------------------------------------------------------------------------------
/examples/formatting.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/formatting.gif
--------------------------------------------------------------------------------
/examples/helm-imenu.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/helm-imenu.gif
--------------------------------------------------------------------------------
/examples/logo-mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/logo-mini.png
--------------------------------------------------------------------------------
/examples/references.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/references.png
--------------------------------------------------------------------------------
/examples/which-key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/which-key.png
--------------------------------------------------------------------------------
/refcard/lsp-refcard.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/refcard/lsp-refcard.pdf
--------------------------------------------------------------------------------
/examples/metals-doctor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/metals-doctor.png
--------------------------------------------------------------------------------
/examples/sym_highlight.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/sym_highlight.gif
--------------------------------------------------------------------------------
/examples/find-definition.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/find-definition.gif
--------------------------------------------------------------------------------
/examples/find-references.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/find-references.gif
--------------------------------------------------------------------------------
/examples/python_debugging.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/python_debugging.png
--------------------------------------------------------------------------------
/docs/tutorials/images/debug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/debug.png
--------------------------------------------------------------------------------
/docs/tutorials/images/mouse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/mouse.png
--------------------------------------------------------------------------------
/examples/references-lsp-ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/references-lsp-ui.png
--------------------------------------------------------------------------------
/examples/symbol-highlights.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/symbol-highlights.gif
--------------------------------------------------------------------------------
/examples/call-hierarchy-ccls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/call-hierarchy-ccls.png
--------------------------------------------------------------------------------
/examples/modeline-diagnostics.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/modeline-diagnostics.png
--------------------------------------------------------------------------------
/test/fixtures/org-mode/org_demo_file_2.py:
--------------------------------------------------------------------------------
1 | def external_function(s):
2 | print s
3 |
4 | external_function("test")
5 |
--------------------------------------------------------------------------------
/docs/tutorials/images/completion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/completion.png
--------------------------------------------------------------------------------
/docs/tutorials/images/hover-info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/hover-info.png
--------------------------------------------------------------------------------
/docs/tutorials/images/turn-off-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/turn-off-1.png
--------------------------------------------------------------------------------
/docs/tutorials/images/turn-off-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/turn-off-2.png
--------------------------------------------------------------------------------
/docs/tutorials/images/turn-off-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/turn-off-3.png
--------------------------------------------------------------------------------
/docs/tutorials/images/turn-off-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/turn-off-4.png
--------------------------------------------------------------------------------
/docs/tutorials/images/which-key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/which-key.png
--------------------------------------------------------------------------------
/examples/lsp-dart-flutter-debug.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-dart-flutter-debug.gif
--------------------------------------------------------------------------------
/docs/template/lsp-client-var.md:
--------------------------------------------------------------------------------
1 | ### `{{name}}`
2 |
3 | _Default: `{{default}}`_
4 |
5 | {{documentation}}
6 |
7 | ---
8 |
9 |
--------------------------------------------------------------------------------
/docs/tutorials/images/errors-list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/errors-list.png
--------------------------------------------------------------------------------
/examples/lsp-rust-analyzer-status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-analyzer-status.png
--------------------------------------------------------------------------------
/examples/lsp-rust-join-lines-after.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-join-lines-after.png
--------------------------------------------------------------------------------
/examples/lsp-rust-join-lines-before.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-join-lines-before.png
--------------------------------------------------------------------------------
/examples/lsp-rust-macro-expansion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-macro-expansion.png
--------------------------------------------------------------------------------
/examples/modeline-code-actions-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/modeline-code-actions-icon.png
--------------------------------------------------------------------------------
/test/fixtures/SampleJsProject/src/sample.js:
--------------------------------------------------------------------------------
1 | function square(n: number): number {
2 | return n * n;
3 | }
4 |
5 | square(2);
6 |
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-rename.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-rename.gif
--------------------------------------------------------------------------------
/docs/tutorials/images/import-project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/import-project.png
--------------------------------------------------------------------------------
/docs/tutorials/images/references-helm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/references-helm.png
--------------------------------------------------------------------------------
/docs/tutorials/images/select-template.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/select-template.png
--------------------------------------------------------------------------------
/docs/tutorials/images/signature-help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/signature-help.png
--------------------------------------------------------------------------------
/examples/clangd_semantic_highlighting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/clangd_semantic_highlighting.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-clean-ns.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-clean-ns.gif
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-code-lens.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-code-lens.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-completion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-completion.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-formatting.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-formatting.gif
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/breakpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/breakpoint.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/js-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/js-error.png
--------------------------------------------------------------------------------
/docs/tutorials/images/workspace-symbols.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/workspace-symbols.png
--------------------------------------------------------------------------------
/examples/clangd-clang-tidy-integration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/clangd-clang-tidy-integration.png
--------------------------------------------------------------------------------
/examples/headerline-breadcrumb-symbols.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/headerline-breadcrumb-symbols.png
--------------------------------------------------------------------------------
/examples/lsp-rust-analyzer-auto-import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-analyzer-auto-import.png
--------------------------------------------------------------------------------
/examples/lsp-rust-analyzer-inlay-hints.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-analyzer-inlay-hints.png
--------------------------------------------------------------------------------
/examples/lsp-rust-analyzer-syntax-tree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/lsp-rust-analyzer-syntax-tree.png
--------------------------------------------------------------------------------
/examples/modeline-code-actions-name-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/modeline-code-actions-name-icon.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/hello-world.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/hello-world.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/intellisense.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/intellisense.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/suggestions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/suggestions.png
--------------------------------------------------------------------------------
/docs/tutorials/images/treemacs-references.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/treemacs-references.png
--------------------------------------------------------------------------------
/examples/modeline-code-actions-count-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/modeline-code-actions-count-icon.png
--------------------------------------------------------------------------------
/test/fixtures/org-mode/demo.cpp:
--------------------------------------------------------------------------------
1 | int fo22();
2 |
3 | int main(int argc, char *argv[])
4 | {
5 | // f22();
6 | f22();
7 | return 0;
8 | }
9 |
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-add-missing-ns.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-add-missing-ns.gif
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-call-hierarchy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-call-hierarchy.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-find-references.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-find-references.gif
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-import-project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-import-project.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-syntax-checker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-syntax-checker.png
--------------------------------------------------------------------------------
/docs/tutorials/images/lsp-treemacs-references.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/lsp-treemacs-references.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/app-is-unused.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/app-is-unused.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/debug-variable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/debug-variable.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/hit-breakpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/hit-breakpoint.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/import-project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/import-project.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/install-server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/install-server.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/parameter-help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/parameter-help.png
--------------------------------------------------------------------------------
/test/fixtures/SampleFlowProject/src/sample-without-flow-comment.js:
--------------------------------------------------------------------------------
1 | function square(n: number): number {
2 | return n * n;
3 | }
4 |
5 | square(2);
6 |
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/bracket-matching.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/bracket-matching.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/extra-semi-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/extra-semi-error.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/welcome-to-react.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/welcome-to-react.png
--------------------------------------------------------------------------------
/examples/modeline-code-actions-count-icon-name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/modeline-code-actions-count-icon-name.png
--------------------------------------------------------------------------------
/test/fixtures/SampleFlowProject/src/sample.js:
--------------------------------------------------------------------------------
1 | /* @flow */
2 |
3 | function square(n: number): number {
4 | return n * n;
5 | }
6 |
7 | square(2);
8 |
--------------------------------------------------------------------------------
/test/fixtures/pyls/test.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | x = 10
4 |
5 | print x
6 |
7 |
8 | def fn1():
9 | pass
10 |
11 |
12 | def fn2():
13 | pass
14 |
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-semantic-tokens-off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-semantic-tokens-off.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-semantic-tokens-on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-semantic-tokens-on.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/debugger-for-chrome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/debugger-for-chrome.png
--------------------------------------------------------------------------------
/docs/tutorials/images/clojure-semantic-tokens-cider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/clojure-semantic-tokens-cider.png
--------------------------------------------------------------------------------
/docs/tutorials/images/reactjs/chrome-debugger-readme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/docs/tutorials/images/reactjs/chrome-debugger-readme.png
--------------------------------------------------------------------------------
/examples/headerline-breadcrumb-project-file-symbols.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/headerline-breadcrumb-project-file-symbols.png
--------------------------------------------------------------------------------
/features/support/projects/pyls/test.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | x = 10
4 |
5 | print x
6 |
7 |
8 | def fn1():
9 | pass
10 |
11 |
12 | def fn2():
13 | pass
14 |
--------------------------------------------------------------------------------
/examples/headerline-breadcrumb-path-up-to-project-file-symbols.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerrypnz/lsp-mode/master/examples/headerline-breadcrumb-path-up-to-project-file-symbols.png
--------------------------------------------------------------------------------
/test/fixtures/org-mode/demo2.cpp:
--------------------------------------------------------------------------------
1 | int fo(int fo) { return fo; };
2 | int fo(int fo, int fo2) { return fo; };
3 |
4 | int main(int a, char *argv[]) {
5 | fo(a);
6 | fo(a);
7 | }
8 |
--------------------------------------------------------------------------------
/.github/labeler.yml:
--------------------------------------------------------------------------------
1 | tutorial:
2 | - docs/tutorials/**/*
3 |
4 | documentation:
5 | - docs/**/*
6 | - mkdocs.yml
7 | - README.md
8 |
9 | client:
10 | - clients/**/*
11 |
--------------------------------------------------------------------------------
/test/fixtures/SampleTypeScriptProject/src/sample.ts:
--------------------------------------------------------------------------------
1 | function greeter(person) {
2 | return "Hello, " + person;
3 | }
4 |
5 | let user = "Jane User";
6 |
7 | document.body.innerHTML = greeter(user);
--------------------------------------------------------------------------------
/docs/Cask:
--------------------------------------------------------------------------------
1 | (source gnu)
2 | (source melpa)
3 | (package-file "lsp-doc.el")
4 | (files "../*.el")
5 |
6 | (depends-on "f")
7 | (depends-on "dash")
8 | (depends-on "seq")
9 | (depends-on "ht")
10 |
--------------------------------------------------------------------------------
/test/fixtures/org-mode/org_demo_file.py:
--------------------------------------------------------------------------------
1 | import org_demo_file_2
2 |
3 | org_demo_file_2.external_function("call2")
4 |
5 | foobar = 10
6 |
7 |
8 | def foo():
9 | org_demo_file_2.external_function("call2")
10 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question
3 | about: Question template
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | Please ask your questions at https://discord.gg/swuxy5AAgT
11 |
--------------------------------------------------------------------------------
/lsp.el:
--------------------------------------------------------------------------------
1 | ;; The code was moved into lsp-mode.el. This file is kept only for backward compatibility.
2 | (require 'lsp-mode)
3 |
4 | ;; (warn "Replace (require 'lsp) with (require 'lsp-mode)")
5 |
6 | (provide 'lsp)
7 |
8 | ;;; lsp.el ends here
9 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | SHELL := /usr/bin/env bash
2 |
3 | deps:
4 | cask
5 |
6 | generate: deps
7 | @echo "Generating..."
8 |
9 | @cask emacs -Q --batch \
10 | -L ../ \
11 | -L ../clients \
12 | -l lsp-doc.el \
13 | -f lsp-doc-generate
14 |
15 | .PHONY: deps generate
16 |
--------------------------------------------------------------------------------
/docs/page/languages.md:
--------------------------------------------------------------------------------
1 | # Languages
2 |
3 | On left, you can find all currently supported languages.
4 |
5 | Some languages have to be installed manually. Others can be installed with M-x`lsp-install-server`. See the language's page for the supported installation method.
6 |
--------------------------------------------------------------------------------
/.github/workflows/labeler.yml:
--------------------------------------------------------------------------------
1 | name: "Pull Request Labeler"
2 | on:
3 | - pull_request_target
4 |
5 | jobs:
6 | triage:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/labeler@main
10 | with:
11 | repo-token: "${{ secrets.GITHUB_TOKEN }}"
12 | sync-labels: true
13 |
--------------------------------------------------------------------------------
/docs/stylesheets/members.css:
--------------------------------------------------------------------------------
1 | /* We use id to not override mkdocs classes */
2 |
3 | #emacs-lsp-members {
4 | overflow: hidden;
5 | }
6 |
7 | #emacs-lsp-members tr td div{
8 | transition: transform .2s;
9 | }
10 |
11 | #emacs-lsp-members tr td div:hover {
12 | transform: scale(1.15);
13 | }
14 |
--------------------------------------------------------------------------------
/docs/stylesheets/layout.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --md-primary-fg-color: #573688;
3 | --md-accent-fg-color: #923EBE;
4 | --md-default-fg-color--light: #7B58B0;
5 | }
6 |
7 | .md-footer {
8 | --md-default-fg-color: #573688;
9 | background-color: var(--md-default-fg-color);
10 | }
11 |
12 | .md-grid {
13 | max-width: 70rem;
14 | }
15 |
16 | .md-typeset a {
17 | color: #7B58B0;
18 | }
19 |
--------------------------------------------------------------------------------
/docs/template/lsp-client.md:
--------------------------------------------------------------------------------
1 | {{full-name}}
2 | =============
3 |
4 | ## Server
5 |
6 | For more information about the LSP server, check [{{server-name}}]({{server-url}}).
7 |
8 | ## Installation
9 |
10 | {{lsp-install-server}}
11 |
12 | {{installation}}{{installation-url}}
13 |
14 | ### Debugger: {{debugger}}
15 |
16 | {{manual-documentation}}
17 |
18 | ## Available configurations
19 |
--------------------------------------------------------------------------------
/docs/page/limitations.md:
--------------------------------------------------------------------------------
1 | # Limitations
2 |
3 | ## File watches
4 |
5 | When some of the workspaces that are active in the current project requests file notifications via `workspace/didChangeWatchedFiles`, `lsp-mode` will start monitoring each of the folders in the workspace for changes. In case your project contains a lot of files you might want to disable file monitoring via `lsp-enable-file-watchers` (you may use dir-locals).
6 |
--------------------------------------------------------------------------------
/test/fixtures/org-mode/java-project/src/main/java/temp/App.java:
--------------------------------------------------------------------------------
1 | package temp;
2 |
3 | class App {
4 | public static void main(final String[] ar) {
5 | System.out.println();
6 | System.currentTimeMillis();
7 | System.currentTimeMillis();
8 |
9 | System.class.getClass();
10 |
11 | ar.toString();
12 | System.class.isArray();
13 | }
14 |
15 | public static void demo() {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/docs/manual-language-docs/lsp-sqls.md:
--------------------------------------------------------------------------------
1 | # Sample configuration:
2 |
3 |
4 | ``` emacs-lisp
5 | (setq lsp-sqls-connections
6 | '(((driver . "mysql") (dataSourceName . "yyoncho:local@tcp(localhost:3306)/foo"))
7 | ((driver . "postgresql") (dataSourceName . "host=127.0.0.1 port=5432 user=yyoncho password=local dbname=sammy sslmode=disable"))))
8 |
9 | ```
10 |
11 | After you have started the server you have pick server connection and database via `M-x lsp-execute-code-action` (or corresponding `M-x lsp-sqls-*`) command.
12 |
--------------------------------------------------------------------------------
/test/fixtures/org-mode/java-project/src/test/java/temp/AppTest.java:
--------------------------------------------------------------------------------
1 | package temp;
2 |
3 | import org.junit.Test;
4 |
5 | public class AppTest {
6 | @Test
7 | public void testA() {
8 | System.out.println("Entering testA...");
9 | App.demo();
10 | fo();
11 | }
12 |
13 |
14 | private void fo() {
15 | System.out.println("Foo called.");
16 | }
17 |
18 | private void foo2() {
19 | System.out.println("Foo called.");
20 | }
21 |
22 | @Test
23 | public void testB() {
24 | System.out.println("Entering testB...\n");
25 | fo();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/refcard/README.md:
--------------------------------------------------------------------------------
1 | # lsp-mode Quick Reference
2 |
3 | Lsp-mode's quick reference is a single-page pdf containing the essential commands one needs to know
4 | to use lsp-mode effectively. You're encouraged to print it, laminate it and keep it on your desk.
5 |
6 | If you want to make changes to it you should first edit `lsp-refcard.tex` and then run the following command
7 | to regenerate the pdf file:
8 |
9 | $ pdflatex lsp-refcard.tex
10 |
11 | Note that you might have to install `pdflatex` first. You can find instructions for all major operating
12 | systems [here](https://www.latex-project.org/get/).
13 |
--------------------------------------------------------------------------------
/Cask:
--------------------------------------------------------------------------------
1 | ;; -*- mode: emacs-lisp -*-
2 |
3 | ;; FIXME: prefer Emacs 28's `lisp-data-mode' over `emacs-lisp-mode'
4 |
5 | (source gnu)
6 | (source melpa)
7 | (package-file "lsp-mode.el")
8 | (files
9 | "lsp-protocol.el"
10 | "lsp-mode.el"
11 | "lsp.el"
12 | "lsp-completion.el"
13 | "lsp-diagnostics.el"
14 | "lsp-headerline.el"
15 | "lsp-iedit.el"
16 | "lsp-lens.el"
17 | "lsp-modeline.el"
18 | "lsp-semantic-tokens.el"
19 | "clients/*.el")
20 |
21 | (development
22 | (depends-on "ert-runner")
23 | (depends-on "espuds")
24 | (depends-on "ecukes")
25 | (depends-on "undercover")
26 | (depends-on "deferred"))
27 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: emacs-lsp
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/features/support/env.el:
--------------------------------------------------------------------------------
1 | (require 'f)
2 |
3 | (when (require 'undercover nil t)
4 | (undercover "*.el"))
5 |
6 | (defvar lsp-mode-support-path
7 | (f-dirname load-file-name))
8 |
9 | (defvar lsp-mode-features-path
10 | (f-parent lsp-mode-support-path))
11 |
12 | (defvar lsp-mode-root-path
13 | (f-parent lsp-mode-features-path))
14 |
15 | (add-to-list 'load-path lsp-mode-root-path)
16 |
17 | ;; Ensure that we don't load old byte-compiled versions
18 | (let ((load-prefer-newer t))
19 | (require 'lsp-mode)
20 | (require 'espuds)
21 | (require 'ert))
22 |
23 | (Setup
24 | (setq lsp-prefer-flymake :none)
25 | )
26 |
27 | (Before
28 | ;; Before each scenario is run
29 | )
30 |
31 | (After
32 | ;; After each scenario is run
33 | )
34 |
35 | (Teardown
36 | ;; After when everything has been run
37 | )
38 |
--------------------------------------------------------------------------------
/features/lsp.feature:
--------------------------------------------------------------------------------
1 | Feature: PYLS configuration
2 |
3 | Background: Server initialized
4 | Given I have workspace folder "pyls"
5 | And I open file "pyls/test.py"
6 | And I call "lsp"
7 | Then the "pyls" status will become "initialized"
8 |
9 | Scenario: xref definitions
10 | Given I place the cursor after "print x"
11 | When I call "lsp-find-definition"
12 | Then the cursor should be before "x = 10"
13 |
14 | Scenario: xref references
15 | Given I place the cursor before "x = 10"
16 | When I select item "2" from the next xref call
17 | And I call "lsp-find-references"
18 | Then the cursor should be after "print "
19 |
20 | Scenario: imenu
21 | Given I go to point "0"
22 | When I goto imenu "Function" -> "fn1"
23 | Then the cursor should be before "def fn1():"
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # -*- mode: gitignore; -*-
2 | *~
3 | \#*\#
4 | /.emacs.desktop
5 | /.emacs.desktop.lock
6 | *.elc
7 | auto-save-list
8 | tramp
9 | .\#*
10 |
11 | # Org-mode
12 | .org-id-locations
13 | *_archive
14 |
15 | # flymake-mode
16 | *_flymake.*
17 |
18 | # eshell files
19 | /eshell/history
20 | /eshell/lastdir
21 |
22 | # elpa packages
23 | /elpa/
24 |
25 | # reftex files
26 | *.rel
27 |
28 | # AUCTeX auto folder
29 | /auto/
30 |
31 | # cask packages
32 | .cask/
33 | dist/
34 |
35 | # Flycheck
36 | flycheck_*.el
37 |
38 | # server auth directory
39 | /server/
40 |
41 | # projectiles files
42 | .projectile
43 |
44 | /*-autoloads.el
45 | /*-pkg.el
46 | /.ecukes-failing-scenarios
47 |
48 | # personal customizations
49 | .dir-locals-2.el
50 |
51 | # java stuff
52 | target
53 | .classpath
54 | .project
55 | .settings
56 | /ert-profile
57 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | Vibhav Pant
2 | Alan Zimmerman
3 | Sebastien Chapuis
4 | George Pittarelli
5 | Philipp Stephani
6 | kyoncho
7 | Fangrui Song
8 | tutysara
9 | gpittarelli
10 | ivan.yonchovski
11 | yyoncho
12 | Steve Purcell
13 | Josh Elsasser
14 | fmdkdd
15 | Caibin Chen
16 | Lukas Fürmetz
17 | Juergen Hoetzel
18 | Bastian Köcher
19 | Katherine Cox-Buday
20 | Jani Sinervo
21 | Ivan Yonchovski
22 | Nate Eagleson
23 | Syohei YOSHIDA
24 | Romanos Skiadas
25 | Parker McGee
26 | Jimmy Yuen Ho Wong
27 | Andy Stewart
28 | Andrew Stahlman
29 | Amol Mandhane
30 | Yuri Albuquerque
31 | Wilfred Hughes
32 | USAMI Kenta
33 | The Gitter Badger
34 | Sho Takemori
35 | sebastien
36 | Rui Silva
37 | Roberto Aloi
38 | MartinWolke
39 | Kieran Barry
40 | Jani SInervo
41 | Iku Iwasa
42 | Hoàng Đức Hiếu
43 | Guillaume Martres
44 | Guido Kraemer
45 | Florian Diebold
46 | Darin Morrison
47 | Cormac Cannon
48 | Christian Kellner
49 | benjaminor
50 | Amos Bird
51 | AmaiKinono
52 | Muir Manders
53 |
--------------------------------------------------------------------------------
/docs/js/expanded_nav.js:
--------------------------------------------------------------------------------
1 | document.addEventListener("DOMContentLoaded", function() {
2 | load_navpane();
3 | });
4 |
5 | // https://github.com/squidfunk/mkdocs-material/issues/767#issuecomment-384558269
6 | function load_navpane() {
7 | var width = window.innerWidth;
8 | if (width <= 1200) {
9 | return;
10 | }
11 |
12 | var nav = document.getElementsByClassName("md-nav");
13 | for(var i = 0; i < nav.length; i++) {
14 | if (typeof nav.item(i).style === "undefined") {
15 | continue;
16 | }
17 |
18 | if (nav.item(i).getAttribute("data-md-level") && nav.item(i).getAttribute("data-md-component")) {
19 | nav.item(i).style.display = 'block';
20 | nav.item(i).style.overflow = 'visible';
21 | }
22 | }
23 |
24 | var nav = document.getElementsByClassName("md-nav__toggle");
25 | for(var i = 0; i < nav.length; i++) {
26 | nav.item(i).checked = true;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/docs/page/gallery.md:
--------------------------------------------------------------------------------
1 | Gallery
2 | =======
3 |
4 | ## RUST Completion
5 |
6 | 
7 |
8 | ## Typescript references using lsp-ui
9 |
10 | 
11 |
12 | ## Debugging Python using dap-mode
13 |
14 | 
15 |
16 | ## Call hierarchy via ccls
17 |
18 | 
19 |
20 | ## Metals Doctor
21 |
22 | 
23 |
24 | ## Flutter debugging
25 |
26 | 
27 |
28 | ## Semantic highlighting
29 |
30 | As provided by clangd, built from unreleased 10.0 branch, in this screenshot, all other font-locking has been disabled (hence no syntax highlighting of comments or basic keywords such as ~auto~):
31 |
32 | 
33 |
34 | ## clang-tidy error explanations
35 |
36 | From the clangd language server:
37 |
38 | 
39 |
--------------------------------------------------------------------------------
/test/fixtures/org-mode/java-project/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | test-project1
5 | test-project
6 | 1.0-SNAPSHOT
7 | jar
8 | test-project
9 | http://maven.apache.org
10 |
11 |
12 | UTF-8
13 | 1.8
14 | 1.8
15 |
16 |
17 |
18 | junit
19 | junit
20 | 4.8.1
21 | test
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # Configure git to ignore commits listed in this file with:
2 | #
3 | # git config blame.ignoreRevsFile .git-blame-ignore-revs
4 |
5 | # Clean up for lsp-haxe. (#2135)
6 | 57a33363aa03a38a1c5a57019362735cebdd15a4
7 |
8 | # Clean up for lsp-javascript. (#2129)
9 | 3678cf7c6c1f949b39759867aefaa735cef8de17
10 |
11 | # Clean up for lsp-csharp (#2132)
12 | ad632a1de8e2f3fc337527d1c9644299558d9bda
13 |
14 | # Clean up some docstrings and fix typos
15 | 220d67462810db2c445ce80efc11eb9151cb2917
16 |
17 | # Reindent lsp-mode using new indentation function
18 | 48e53d1f4c9558fd88a4ea66bb40312c6558b01b
19 |
20 | # Fix another typo (#1965)
21 | 1530757b9c66c88ef77cf97bd023211de9833ed0
22 |
23 | # Migrate to new form of ‘if-let’ and ‘when-let’. (#1991)
24 | c7199f6bd95d174b20bb5f6fb4e7b24c6ce1784a
25 |
26 | # Fix typos (#1964)
27 | 1c18d4362d7cacc3b4ef8ff5cc9f336c123a89e5
28 |
29 | # Fix typos (#1618)
30 | 485d8d23d096cb98aa9b79249a3c96c25ad61e6a
31 |
32 | # Fix typos (#1687)
33 | bac42c50b370f3716f258506dc1ae9f62906313f
34 |
35 | # Remove some Emacs < 26, and fix some whitespace/indentation (#1955)
36 | b08232485c050708ea261405ced8d704a5861d49
37 |
--------------------------------------------------------------------------------
/.github/workflows/docs.yml:
--------------------------------------------------------------------------------
1 | name: Docs
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout
13 | uses: actions/checkout@v2
14 |
15 | - name: CHANGELOG.org -> CHANGELOG.md
16 | uses: docker://pandoc/core:2.9
17 | with:
18 | args: -s CHANGELOG.org -t gfm -o docs/page/CHANGELOG.md
19 |
20 | - uses: purcell/setup-emacs@master
21 | with:
22 | version: 27.1
23 |
24 | - uses: conao3/setup-cask@master
25 | with:
26 | version: 0.8.4
27 |
28 | - name: Generate LSPs docs
29 | run: 'make docs'
30 |
31 | - name: MkDocs
32 | run: |
33 | cp -rf README.md examples docs
34 |
35 | docker login docker.pkg.github.com --username $GITHUB_ACTOR --password ${{ secrets.GITHUB_TOKEN }}
36 | docker run --rm -v ${PWD}:/docs docker.pkg.github.com/emacs-lsp/docs-image/docs-image -- build
37 |
38 | - name: Deploy
39 | uses: peaceiris/actions-gh-pages@v3
40 | with:
41 | github_token: ${{ secrets.GITHUB_TOKEN }}
42 | publish_dir: ./site
43 |
--------------------------------------------------------------------------------
/test/test-helper.el:
--------------------------------------------------------------------------------
1 | ;;; test-helper.el --- Helpers for lsp-mode-test.el -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2018 Google LLC
4 |
5 | ;; This program is free software: you can redistribute it and/or modify
6 | ;; it under the terms of the GNU General Public License as published by
7 | ;; the Free Software Foundation, either version 3 of the License, or
8 | ;; (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program. If not, see .
17 |
18 | ;;; Commentary:
19 |
20 | ;; Initializes test support for ‘lsp-mode’.
21 |
22 | ;;; Code:
23 |
24 | (require 'f)
25 |
26 | (setq safe-local-variable-values
27 | '((flycheck-disabled-checkers emacs-lisp-checkdoc)))
28 |
29 |
30 | ;; (when (require 'undercover nil t)
31 | ;; (undercover "*.el" (:report-type :codecov)))
32 |
33 | (add-to-list 'load-path
34 | (file-name-as-directory (f-parent (f-parent (f-this-file)))))
35 |
36 | ;;; test-helper.el ends here
37 |
--------------------------------------------------------------------------------
/docs/page/troubleshooting.md:
--------------------------------------------------------------------------------
1 | Troubleshooting
2 | ===============
3 |
4 | - Check `*lsp-log*` buffer and verify that `lsp-mode` is able to find the server. If `lsp-mode` is unable to find the binary but it is on the path it is probably caused by the fact that emacs is running with different path. You may check the current path by executing M-: `(getenv "PATH")`. If this is the case, you have several options to fix the issue.
5 | - make sure that emacs is using the proper path by running emacs from terminal.
6 | - Modify the path using `setpath`.
7 | - Look for `lsp-mode` variable to customize server path. Usually, you may find the variable by doing:
8 | M-x `customize-group` RET `lsp-LANGUAGE-SERVER-ID`.
9 | - Set `lsp-log-io` to `t` to inspect communication between client and the server. Use `lsp-workspace-show-log` to switch to the corresponding log buffer.
10 | - `lsp-describe-session` will show the current projects roots + the started servers and allows inspecting the server capabilities:
11 |
12 | 
13 | - If you manage your Emacs packages with the built-in `package.el`, we recommend the following procedure to update your packages:
14 |
15 | 1. Delete your LSP-related packages
16 | 2. Restart Emacs
17 | 3. Install the new versions of the packages.
18 |
--------------------------------------------------------------------------------
/scripts/lsp-vscode-snippets.el:
--------------------------------------------------------------------------------
1 |
2 | (defun lsp-load-and-save-snippets (file-name mode dir)
3 | (ht-each
4 | (-lambda (name (&hash "description" "body" "prefix"))
5 | (with-temp-buffer (insert (format "# -*- mode: snippet -*-
6 | # name: %s
7 | # key: %s
8 | # --
9 | %s
10 | "
11 | name
12 | prefix
13 | (lsp-fix-snippet (s-join "\n" body))))
14 | (yas-load-snippet-buffer mode)
15 | (f-write-text (buffer-string) 'utf-8 (f-join dir prefix))
16 | ))
17 | (json-parse-string (f-read-text file-name))))
18 |
19 | (defun lsp-fix-snippet (string)
20 | (-let* ((regex "\\(\\${[[:digit:]]*:[[:alnum:]]*}\\).*")
21 | (part (cl-second (s-match regex string))))
22 | (if part
23 | (let* ((index (s-index-of part string))
24 | (s1 (substring string 0 (+ index (length part))))
25 | (s2 (substring string (+ index (length part)))))
26 | (concat s1 (lsp-fix-snippet (s-replace part (concat "$" (cl-second (s-match "{\\([[:digit:]]*\\).*}" part))) s2))))
27 | string)))
28 |
29 | ;; (lsp-load-and-save-snippets "/home/kyoncho/Sources/vscode-mssql/snippets/mssql.json" 'sql-mode "/home/kyoncho/Sources/lsp/lsp-mssql/snippets/")
30 |
--------------------------------------------------------------------------------
/test/fixtures/org-mode/demo.org:
--------------------------------------------------------------------------------
1 | #+BEGIN_SRC python :tangle "org_demo_file.py"
2 | import org_demo_file_2
3 |
4 | org_demo_file_2.external_function("call2")
5 |
6 | foobar = 10
7 |
8 |
9 | def foo():
10 | org_demo_file_2.external_function("call2")
11 | #+END_SRC
12 |
13 | * LSP/DAP interactive features <-> org-mode (preview)
14 | ** Python
15 | #+BEGIN_SRC python :tangle "org_demo_file_2.py"
16 | def external_function(s):
17 | print s
18 |
19 | external_function("test")
20 | #+END_SRC
21 |
22 | ** Java
23 | #+BEGIN_SRC java :tangle java-project/src/test/java/temp/AppTest.java
24 | package temp;
25 |
26 | import org.junit.Test;
27 |
28 | public class AppTest {
29 | @Test
30 | public void testA() {
31 | System.out.println("Entering testA...");
32 | App.demo();
33 | fo();
34 | }
35 |
36 |
37 | private void fo() {
38 | System.out.println("Foo called.");
39 | }
40 |
41 | private void foo2() {
42 | System.out.println("Foo called.");
43 | }
44 |
45 | @Test
46 | public void testB() {
47 | System.out.println("Entering testB...\n");
48 | fo();
49 | }
50 |
51 | }
52 | #+END_SRC
53 |
54 | ** C++
55 | #+BEGIN_SRC c :tangle "demo2.cpp"
56 | int fo(int fo) { return fo; };
57 | int fo(int fo, int fo2) { return fo; };
58 |
59 | int main(int a, char *argv[]) {
60 | fo(a);
61 | fo(a);
62 | }
63 | #+END_SRC
64 |
--------------------------------------------------------------------------------
/clients/lsp-nim.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-nim.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, nim
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Nim Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | ;; Nim
30 | (defgroup lsp-nimlsp nil
31 | "LSP support for Nim, using nimlsp."
32 | :group 'lsp-mode
33 | :link '(url-link "https://github.com/PMunch/nimlsp"))
34 |
35 | (lsp-register-client
36 | (make-lsp-client :new-connection (lsp-stdio-connection "nimlsp")
37 | :major-modes '(nim-mode)
38 | :priority -1
39 | :server-id 'nimls))
40 |
41 |
42 | (provide 'lsp-nim)
43 | ;;; lsp-nim.el ends here
44 |
--------------------------------------------------------------------------------
/clients/lsp-dhall.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-dhall.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, dhall
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Dhall Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-dhall nil
30 | "LSP support for Dhall, using dhall-lsp-server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/dhall-lang/dhall-haskell"))
33 |
34 | (lsp-register-client
35 | (make-lsp-client :new-connection (lsp-stdio-connection "dhall-lsp-server")
36 | :major-modes '(dhall-mode)
37 | :priority -1
38 | :server-id 'dhallls))
39 |
40 | (provide 'lsp-dhall)
41 | ;;; lsp-dhall.el ends here
42 |
--------------------------------------------------------------------------------
/clients/lsp-cmake.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-cmake.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, cmake
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the CMake build tool.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-cmake nil
30 | "LSP support for CMake, using cmake-language-server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/regen100/cmake-language-server"))
33 |
34 | (lsp-register-client
35 | (make-lsp-client :new-connection (lsp-stdio-connection "cmake-language-server")
36 | :major-modes '(cmake-mode)
37 | :priority -1
38 | :server-id 'cmakels))
39 |
40 | (provide 'lsp-cmake)
41 | ;;; lsp-cmake.el ends here
42 |
--------------------------------------------------------------------------------
/docs/manual-language-docs/lsp-latex.md:
--------------------------------------------------------------------------------
1 | ## Available functions
2 | ### `lsp-latex-build`
3 | Build .tex files with texlab.
4 | It use latexmk by default, so add .latexmkrc if you want to customize
5 | latex commands or options. You can change build command and option to other
6 | such as `make`, by changing `lsp-latex-build-executable` and
7 | `lsp-latex-build-args`.
8 |
9 | This command builds asynchronously by default, while it build synchronously
10 | with prefix argument(C-u).
11 |
12 | ### `lsp-latex-forward-search`
13 | Move to current position on pdf viewer.
14 | To use, you should set `lsp-latex-forward-search-executable` and
15 | `lsp-latex-forward-search-args` according to your pdf viewer.
16 | See also [document of texlab](https://texlab.netlify.app/docs/installation/previewing).
17 |
18 | ## Note
19 | In this package, you can use even texlab v0.4.2 or older, written with Java,
20 | though it is not recommended. If you want to use them, you can write like:
21 |
22 | ``` emacs-lisp
23 | ;; Path to Java executable. If it is added to environmental PATH,
24 | ;; you don't have to write this.
25 | (setq lsp-latex-java-executable "/path/to/java")
26 |
27 | ;; "texlab.jar" must be located at a directory contained in `exec-path'
28 | ;; "texlab" must be located at a directory contained in `exec-path'.
29 | (setq lsp-latex-texlab-jar-file 'search-from-exec-path)
30 | ;; If you want to put "texlab.jar" somewhere else,
31 | ;; you can specify the path to "texlab.jar" as follows:
32 | ;; (setq lsp-latex-texlab-jar-file "/path/to/texlab.jar")
33 | ```
34 |
--------------------------------------------------------------------------------
/clients/lsp-r.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-r.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, r
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the R Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-r nil
30 | "LSP support for R."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/REditorSupport/languageserver"))
33 |
34 | (defcustom lsp-clients-r-server-command '("R" "--slave" "-e" "languageserver::run()")
35 | "Command to start the R language server."
36 | :group 'lsp-r
37 | :risky t
38 | :type '(repeat string))
39 |
40 | (lsp-register-client
41 | (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-r-server-command)
42 | :major-modes '(ess-r-mode)
43 | :server-id 'lsp-r))
44 |
45 |
46 | (provide 'lsp-r)
47 | ;;; lsp-r.el ends here
48 |
--------------------------------------------------------------------------------
/clients/lsp-nix.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-nix.el --- lsp-mode nix integration -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 lsp-mode maintainers
4 |
5 | ;; Author: Seong Yong-ju
6 | ;; Keywords: languages
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; Client for the rnix language server.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-nix nil
30 | "LSP support for Nix, using rnix-lsp."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/nix-community/rnix-lsp"))
33 |
34 | (defcustom lsp-nix-server-path "rnix-lsp"
35 | "Executable path for the server."
36 | :group 'lsp-nix
37 | :type 'string
38 | :package-version '(lsp-mode . "7.1"))
39 |
40 | (lsp-register-client
41 | (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-nix-server-path))
42 | :major-modes '(nix-mode)
43 | :server-id 'rnix-lsp))
44 |
45 | (provide 'lsp-nix)
46 | ;;; lsp-nix.el ends here
47 |
--------------------------------------------------------------------------------
/clients/lsp-crystal.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-crystal.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, crystal
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Crystal Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-scry nil
30 | "LSP support for Crystal via scry."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/crystal-lang-tools/scry"))
33 |
34 | (defcustom lsp-clients-crystal-executable '("scry" "--stdio")
35 | "Command to start the scry language server."
36 | :group 'lsp-scry
37 | :risky t
38 | :type 'file)
39 |
40 | (lsp-register-client
41 | (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-crystal-executable)
42 | :major-modes '(crystal-mode)
43 | :server-id 'scry))
44 |
45 | (provide 'lsp-crystal)
46 | ;;; lsp-crystal.el ends here
47 |
--------------------------------------------------------------------------------
/clients/lsp-vala.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-vala.el --- Vala Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 Daniel Svensson
4 |
5 | ;; Author: Daniel Svensson
6 | ;; Keywords: vala lsp
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP client for Vala
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-vala nil
30 | "LSP support for Vala, using vala-language-server"
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/benwaffle/vala-language-server")
33 | :package-version `(lsp-mode . "7.1.0"))
34 |
35 | (defcustom lsp-clients-vala-ls-executable "vala-language-server"
36 | "Path to the `vala-language-server' binary."
37 | :group 'lsp-vala
38 | :risky t
39 | :type 'file
40 | :package-version `(lsp-mode . "7.1.0"))
41 |
42 | (lsp-register-client
43 | (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-clients-vala-ls-executable))
44 | :major-modes '(vala-mode)
45 | :priority -1
46 | :server-id 'valals))
47 |
48 | (provide 'lsp-vala)
49 | ;;; lsp-vala.el ends here
50 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | unix-test:
7 | runs-on: ubuntu-latest
8 | strategy:
9 | matrix:
10 | emacs-version:
11 | - 26.1
12 | - 26.2
13 | - 26.3
14 | - 27.1
15 | - snapshot
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 |
20 | - uses: actions/setup-python@v2
21 | with:
22 | python-version: "3.6"
23 | architecture: "x64"
24 |
25 | - uses: purcell/setup-emacs@master
26 | with:
27 | version: ${{ matrix.emacs-version }}
28 |
29 | - uses: conao3/setup-cask@master
30 | with:
31 | version: 0.8.4
32 |
33 | - name: Install depedencies
34 | run: "pip3 install python-language-server"
35 |
36 | - name: Run tests
37 | run:
38 | make unix-ci
39 |
40 | windows-test:
41 | runs-on: windows-latest
42 | strategy:
43 | matrix:
44 | emacs-version:
45 | - 27.1
46 |
47 | steps:
48 | - uses: actions/checkout@v2
49 |
50 | - uses: actions/setup-python@v2
51 | with:
52 | python-version: "3.6"
53 | architecture: "x64"
54 |
55 | - uses: jcs090218/setup-emacs-windows@master
56 | with:
57 | version: ${{ matrix.emacs-version }}
58 |
59 | - name: Install depedencies
60 | run: "pip install python-language-server"
61 |
62 | - name: Run tests
63 | run:
64 | make windows-ci
65 |
--------------------------------------------------------------------------------
/test/windows-bootstrap.el:
--------------------------------------------------------------------------------
1 | ;;; windows-bootstrap.el --- Windows test bootstrap -*- lexical-binding: t; -*-
2 | ;;
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 | ;;
5 | ;; This program is free software; you can redistribute it and/or modify
6 | ;; it under the terms of the GNU General Public License as published by
7 | ;; the Free Software Foundation, either version 3 of the License, or
8 | ;; (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program. If not, see .
17 | ;;
18 | ;;; Commentary:
19 | ;;
20 | ;; Windows test bootstrap
21 | ;;
22 | ;;; Code:
23 |
24 | (require 'package)
25 |
26 |
27 | (setq user-emacs-directory (expand-file-name (make-temp-name ".emacs.d")
28 | "~")
29 | package-user-dir (expand-file-name (make-temp-name "tmp-elpa")
30 | user-emacs-directory))
31 |
32 | (let* ((package-archives '(("melpa" . "https://melpa.org/packages/")
33 | ("gnu" . "https://elpa.gnu.org/packages/")))
34 | (pkgs '(dash dash-functional f lv ht spinner markdown-mode deferred)))
35 | (package-initialize)
36 | (package-refresh-contents)
37 |
38 | (mapc (lambda (pkg)
39 | (unless (package-installed-p pkg)
40 | (package-install pkg)))
41 | pkgs)
42 |
43 | (add-hook 'kill-emacs-hook
44 | `(lambda () (delete-directory ,user-emacs-directory t))))
45 |
46 | ;;; windows-bootstrap.el ends here
47 |
--------------------------------------------------------------------------------
/docs/manual-language-docs/lsp-org.md:
--------------------------------------------------------------------------------
1 | # Literate programming using LSP and org-mode(alpha)
2 | `lsp-mode` provides **experimental** support for running the language servers
3 | inside of [org-mode](https://orgmode.org/) source blocks. `lsp-mode` is
4 | achieving this by obtaining the information about the source block from the
5 | source block header(language + `:tangle`) then translating the point to the LSP
6 | positions back and forth so the language server thinks that Emacs has opened the
7 | original file. In order that to work the files has to be present on the disk as
8 | well because the server expects to find them.
9 |
10 | Here it is a sample source block:
11 |
12 | ``` org
13 | #+BEGIN_SRC python :tangle "python.py"
14 | print "Hello!"
15 | #+END_SRC
16 | ```
17 |
18 | ## Demo
19 | 
20 |
21 | ## Commands
22 | * `lsp-org` start `lsp-mode` in source buffer. Must be executed with cursor
23 | being source block.
24 | * `lsp-virtual-buffer-disconnect` turn off `lsp-mode`.
25 |
26 | ## What works
27 | * `lsp-mode` core features (finding references, going to definitions, completion, lenses, highlighting, etc)
28 | * `company-mode`
29 | * `flycheck`
30 | * `lsp-treemacs-symbols`
31 | * `lsp-treemacs-errors-list`
32 |
33 | ## Known limitations
34 | * Incremental updates are performed by sending the whole
35 | buffer each time(they simulate full updates).
36 | * Deleting content that spans across the source block and the content of the org
37 | document is not handled.
38 | * Opening and editing the actual file from the disk might cause undefined
39 | behaviour because the server expects file to be open only once.
40 |
41 | ## What does not work
42 | * `dap-mode`
43 | * `lsp-ui`
44 | * `flymake`(?)
45 |
46 | ## What's next
47 | - Finishing the virtual buffers `API`.
48 | - `lsp-ui` support
49 | - `dap-mode` support
50 | - `markdown-mode` integration
51 |
--------------------------------------------------------------------------------
/clients/lsp-prolog.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-prolog.el --- Prolog Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 James Cash
4 |
5 | ;; Author: James Cash
6 | ;; Keywords: languages,tools
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; lsp-prolog client
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-prolog nil
30 | "LSP support for Prolog."
31 | :link '(url-link "https://github.com/jamesnvc/lsp_server")
32 | :group 'lsp-mode
33 | :tag "Lsp Prolog")
34 |
35 | (defcustom lsp-prolog-server-command '("swipl"
36 | "-g" "use_module(library(lsp_server))."
37 | "-g" "lsp_server:main"
38 | "-t" "halt"
39 | "--" "stdio")
40 | "The prolog-lsp server command."
41 | :group 'lsp-prolog
42 | :risky t
43 | :type 'list)
44 |
45 | (lsp-register-client
46 | (make-lsp-client
47 | :new-connection (lsp-stdio-connection (lambda () lsp-prolog-server-command))
48 | :major-modes '(prolog-mode)
49 | :multi-root t
50 | :server-id 'prolog-lsp))
51 |
52 | (provide 'lsp-prolog)
53 | ;;; lsp-prolog.el ends here
54 |
--------------------------------------------------------------------------------
/clients/lsp-sorbet.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-sorbet.el --- Sorbet server configuration -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020
4 |
5 | ;; Author: Christopher Wilson
6 | ;; Keywords:
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; lsp-sorbet client
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-sorbet nil
30 | "LSP support for Ruby, using the Sorbet language server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/sorbet/sorbet")
33 | :package-version '(lsp-mode . "7.1.0"))
34 |
35 | (defcustom lsp-sorbet-use-bundler nil
36 | "Run sorbet under bundler"
37 | :type 'boolean
38 | :group 'lsp-sorbet
39 | :package-version '(lsp-mode . "7.1.0"))
40 |
41 | (defun lsp-sorbet--build-command ()
42 | "Build sorbet command"
43 | (let ((lsp-command '("srb" "typecheck" "--lsp" "--disable-watchman")))
44 | (if lsp-sorbet-use-bundler
45 | (append '("bundle" "exec") lsp-command)
46 | lsp-command)))
47 |
48 | (lsp-register-client
49 | (make-lsp-client
50 | :new-connection (lsp-stdio-connection
51 | #'lsp-sorbet--build-command)
52 | :priority -2
53 | :major-modes '(ruby-mode enh-ruby-mode)
54 | :server-id 'sorbet-ls))
55 |
56 | (provide 'lsp-sorbet)
57 | ;;; lsp-sorbet.el ends here
58 |
--------------------------------------------------------------------------------
/clients/lsp-hack.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-xxx.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, hack
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Hack Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-hack nil
30 | "LSP support for Hack, using HHVM."
31 | :group 'lsp-mode
32 | :link '(url-link "https://docs.hhvm.com/hhvm"))
33 |
34 | (defcustom lsp-clients-hack-command '("hh_client" "lsp" "--from" "emacs")
35 | "Command to start hh_client."
36 | :group 'lsp-hack
37 | :risky t
38 | :type '(repeat string))
39 |
40 | (lsp-register-client
41 | (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-clients-hack-command))
42 | :major-modes '(hack-mode)
43 | :priority -1
44 | :server-id 'hack
45 | ;; ignore some unsupported messages from Nuclide
46 | :notification-handlers (lsp-ht ("telemetry/event" 'ignore)
47 | ("$/cancelRequest" 'ignore))
48 | :request-handlers (lsp-ht ("window/showStatus" 'ignore))))
49 |
50 |
51 | (provide 'lsp-hack)
52 | ;;; lsp-hack.el ends here
53 |
--------------------------------------------------------------------------------
/docs/page/remote.md:
--------------------------------------------------------------------------------
1 | # Remote
2 |
3 | ## TRAMP
4 |
5 | LSP mode has support for tramp buffers with the following requirements:
6 |
7 | - The language server has to be present on the remote server.
8 | - Having multi folder language server (like [Eclipse JDT LS](https://github.com/eclipse/eclipse.jdt.ls)) cannot have local and remote workspace folders.
9 |
10 | ### How does it work?
11 |
12 | `lsp-mode` detects whether a particular file is located on remote machine and looks for a client which matches current file and it is marked as `:remote?` t. Then `lsp-mode` starts the client through tramp.
13 |
14 | ### Sample configuration
15 |
16 | Here it is example how you can configure python language server to work when using `TRAMP`. Note that if you are trying to convert existing language server configuration you should copy all of it's properties(e. g. `:request-handlers`, `activation-fn`, etc). Also, when you are doing that you should make sure that none of the custom language server settings are not pointing to local path because those settings will be sent to the remote server.
17 |
18 | ```elisp
19 | (lsp-register-client
20 | (make-lsp-client :new-connection (lsp-tramp-connection "")
21 | :major-modes '(python-mode)
22 | :remote? t
23 | :server-id 'pyls-remote))
24 | ```
25 |
26 | _Note:_ when you do not have root privileges on the remote machine to put the language server on the path you may alter the remote path by changing `tramp-remote-path`.
27 |
28 | ### Dealing with stderr
29 |
30 | With TRAMP, Emacs does not have an easy way to distinguish stdout and stderr, so when the underlying LSP process writes to stderr, it breaks the `lsp-mode` parser. As a workaround, `lsp-mode` is redirecting stderr to `/tmp/-~stderr`.
31 |
32 |
33 | ## Docker
34 |
35 | Refer to [lsp-docker](https://github.com/emacs-lsp/lsp-docker/) README which provides a guide on how you can run `lsp-mode` in `docker` container.
36 |
--------------------------------------------------------------------------------
/clients/lsp-verilog.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-verilog.el --- Verilog Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Patrick Grogan
4 |
5 | ;; Author: Patrick Grogan
6 | ;; Created: 7 December 2019
7 | ;; Keywords: languages, lsp, verilog
8 |
9 | ;; This program is free software; you can redistribute it and/or modify
10 | ;; it under the terms of the GNU General Public License as published by
11 | ;; the Free Software Foundation, either version 3 of the License, or
12 | ;; (at your option) any later version.
13 |
14 | ;; This program is distributed in the hope that it will be useful,
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ;; GNU General Public License for more details.
18 |
19 | ;; You should have received a copy of the GNU General Public License
20 | ;; along with this program. If not, see .
21 |
22 | ;;; Commentary:
23 | ;; LSP client support for Verilog. Right now, the only supported LSP server
24 | ;; is HDL CHecker. See https://github.com/suoto/hdl_checker
25 | ;;
26 | ;; This file is based on the lsp-vhdl.el file.
27 | ;;
28 | ;; Set the lsp-verilog-server-path to the binary directory if it is not
29 | ;; in the User path;
30 |
31 | ;;; Code:
32 |
33 | (require 'lsp-mode)
34 |
35 | (defgroup lsp-verilog nil
36 | "LSP support for Verilog/SystemVerilog."
37 | :group 'lsp-mode
38 | :link '(url-link "https://github.com/suoto/hdl_checker"))
39 |
40 | (defcustom lsp-clients-verilog-executable '("hdl_checker" "--lsp")
41 | "Command to start the hdl_checker language server."
42 | :group 'lsp-verilog
43 | :risky t
44 | :type 'file)
45 |
46 | (lsp-register-client
47 | (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-verilog-executable)
48 | :major-modes '(verilog-mode)
49 | :language-id "verilog"
50 | :priority -1
51 | :server-id 'lsp-verilog))
52 |
53 | (provide 'lsp-verilog)
54 | ;;; lsp-verilog.el ends here
55 |
--------------------------------------------------------------------------------
/clients/lsp-fortran.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-fortran.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, fortran
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Fortran Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-fortran nil
30 | "LSP support for Fortran, using the Fortran Language Server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/hansec/fortran-language-server"))
33 |
34 | (defcustom lsp-clients-fortls-executable "fortls"
35 | "The fortls executable to use.
36 | Leave as just the executable name to use the default behavior of
37 | finding the executable with `exec-path'."
38 | :group 'lsp-fortran
39 | :risky t
40 | :type 'file)
41 |
42 | (defcustom lsp-clients-fortls-args '()
43 | "Extra arguments for the fortls executable"
44 | :group 'lsp-fortran
45 | :risky t
46 | :type '(repeat string))
47 |
48 | (defun lsp-clients--fortls-command ()
49 | "Generate the language server startup command."
50 | `(,lsp-clients-fortls-executable,@lsp-clients-fortls-args))
51 |
52 | (lsp-register-client
53 | (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-clients--fortls-command)
54 | :major-modes '(f90-mode fortran-mode)
55 | :priority -1
56 | :server-id 'fortls))
57 |
58 | (provide 'lsp-fortran)
59 | ;;; lsp-fortran.el ends here
60 |
--------------------------------------------------------------------------------
/clients/lsp-steep.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-steep.el --- lsp-mode for Steep -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 Masafumi Koba
4 |
5 | ;; Author: Masafumi Koba
6 | ;; Keywords: languages
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP client for Steep which is a Ruby type checker.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-steep nil
30 | "LSP support for Steep, using the Steep language server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/soutaro/steep"))
33 |
34 | (defcustom lsp-steep-log-level "warn"
35 | "Log level of Steep."
36 | :type '(choice
37 | (const "fatal")
38 | (const "error")
39 | (const "warn")
40 | (const "info")
41 | (const "debug"))
42 | :group 'lsp-steep)
43 |
44 | (defcustom lsp-steep-use-bundler t
45 | "Run Steep using Bunder."
46 | :type 'boolean
47 | :safe #'booleanp
48 | :group 'lsp-steep)
49 |
50 | (defun lsp-steep--build-command ()
51 | "Build a command to start the Steep language server."
52 | (append
53 | (if lsp-steep-use-bundler '("bundle" "exec"))
54 | '("steep" "langserver")
55 | (list (concat "--log-level=" lsp-steep-log-level))))
56 |
57 | (lsp-register-client
58 | (make-lsp-client
59 | :new-connection (lsp-stdio-connection #'lsp-steep--build-command)
60 | :major-modes '(ruby-mode enh-ruby-mode)
61 | :priority -3
62 | :server-id 'steep-ls))
63 |
64 | (provide 'lsp-steep)
65 | ;;; lsp-steep.el ends here
66 |
--------------------------------------------------------------------------------
/clients/lsp-terraform.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-terraform.el --- Terraform Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Ross Donaldson
4 |
5 | ;; Author: Ross Donaldson
6 | ;; Keywords: terraform lsp
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP client for Terraform
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-terraform nil
30 | "LSP support for Terraform, using terraform-lsp"
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/juliosueiras/terraform-lsp")
33 | :package-version `(lsp-mode . "6.2"))
34 |
35 | (defcustom lsp-terraform-server "terraform-lsp"
36 | "Path to the `terraform-lsp' binary."
37 | :group 'lsp-terraform
38 | :risky t
39 | :type 'file
40 | :package-version `(lsp-mode . "6.2"))
41 |
42 | (defcustom lsp-terraform-enable-logging nil
43 | "If non-nil, enable `terraform-ls''s native logging."
44 | :group 'lsp-terraform
45 | :risky t
46 | :type 'boolean
47 | :package-version `(lsp-mode . "6.2"))
48 |
49 | (defun lsp-terraform--make-launch-cmd ()
50 | (-let [base `(,lsp-terraform-server)]
51 | (when lsp-terraform-enable-logging
52 | (push "-enable-log-file" base))
53 | base))
54 |
55 | (lsp-register-client
56 | (make-lsp-client :new-connection (lsp-stdio-connection #'lsp-terraform--make-launch-cmd)
57 | :major-modes '(terraform-mode)
58 | :priority -1
59 | :server-id 'tfls))
60 |
61 | (provide 'lsp-terraform)
62 | ;;; lsp-terraform.el ends here
63 |
--------------------------------------------------------------------------------
/clients/lsp-gdscript.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-gdscript.el --- LSP mode -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 Oliver Frank
4 |
5 | ;; Author: Oliver Frank
6 | ;; Keywords: languages
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; lsp-gdscript client
24 |
25 | ;;; Code:
26 | (require 'lsp-mode)
27 |
28 | (defgroup lsp-gdscript nil
29 | "LSP support for GDScript, using godot's language server."
30 | :group 'lsp-mode
31 | :link '(url-link "https://github.com/godotengine/godot")
32 | :package-version '(lsp-mode . "6.1"))
33 |
34 | (defcustom lsp-gdscript-port 6008
35 | "Port to connect server to"
36 | :type 'integer
37 | :group 'lsp-gdscript)
38 |
39 | (defun lsp-gdscript-tcp-connect-to-port ()
40 | (list
41 | :connect (lambda (filter sentinel name _environment-fn)
42 | (let* ((host "localhost")
43 | (port lsp-gdscript-port)
44 | (tcp-proc (lsp--open-network-stream host port (concat name "::tcp"))))
45 |
46 | (set-process-query-on-exit-flag tcp-proc nil)
47 | (set-process-filter tcp-proc filter)
48 | (set-process-sentinel tcp-proc sentinel)
49 | (cons tcp-proc tcp-proc)))
50 | :test? (lambda () t)))
51 |
52 | (lsp-register-client
53 | (make-lsp-client :new-connection (lsp-gdscript-tcp-connect-to-port)
54 | :major-modes '(gdscript-mode)
55 | :server-id 'gdscript))
56 |
57 | (provide 'lsp-gdscript)
58 |
59 | ;;; lsp-gdscript.el ends here
60 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | Before logging the bug, please make sure that:
11 |
12 | 1. You are using the latest version of `lsp-mode` related packages.
13 | 2. You may also try reproduce the issue using clean environment using the following command:
14 | ``` bash
15 | emacs -q -l lsp-start-plain.el
16 | ```
17 | where `lsp-start-plain.el` could be downloaded from `https://github.com/emacs-lsp/lsp-mode/blob/master/scripts/lsp-start-plain.el`.
18 | Alternatively, in will be great if you can reproduce the issue using [lsp-docker](https://github.com/emacs-lsp/lsp-docker/) which provides the minimal configurations for `lsp-mode` and ships with most of the language servers.
19 | 3. Check FAQ and Troubleshooting section (https://emacs-lsp.github.io/lsp-mode/page/faq/ and https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/)
20 | 4. Consider providing a minimal project to reproduce the issue with. Note that `lsp-mode` supports 30+ languages and the maintainers of the project are not familiar with all of the languages and a sample project + full steps to reproduce will help a lot.
21 |
22 | **Describe the bug**
23 | A clear and concise description of what the bug is.
24 |
25 | **To Reproduce**
26 | Steps to reproduce the behavior(sample project + file which can be used to reproduce the issue with.)
27 |
28 | **Expected behavior**
29 | A clear and concise description of what you expected to happen.
30 |
31 | **Which Language Server did you use**
32 | Mention which server/language did you use (e. g. lsp-python, lsp-ccls, lsp-java, etc)
33 |
34 | **OS**
35 | Which os do you use?
36 |
37 | **Error callstack**
38 | If there is an error please reproduce the issue with `toggle-debug-on-error` and after setting `lsp-print-io` to t, and then include the callstack and attach the content of `*lsp-log*` buffer and the content of the server log(use `lsp-workspace-show-log`)
39 |
40 | If `emacs` hangs please do `M-x` `toggle-debug-on-quit` and then do `C-g` when emacs hangs and include the callstack as part of the issue report.
41 |
42 | ``` emacs-lisp
43 | (setq lsp-print-io t)
44 | ```
45 |
--------------------------------------------------------------------------------
/clients/lsp-erlang.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-erlang.el --- Erlang Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Roberto Aloi
4 |
5 | ;; Author: Roberto Aloi
6 | ;; Keywords: erlang lsp
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; lsp-erlang client
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-erlang nil
30 | "LSP support for the Erlang programming language, using erlang-ls"
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/erlang-ls/erlang_ls"))
33 |
34 | (defcustom lsp-erlang-server-path
35 | "erlang_ls"
36 | "Path to the Erlang Language Server binary."
37 | :group 'lsp-erlang
38 | :risky t
39 | :type 'file)
40 |
41 | (defcustom lsp-erlang-server-connection-type
42 | 'stdio
43 | "Type of connection to use with the Erlang Language Server: tcp or stdio"
44 | :group 'lsp-erlang
45 | :risky t
46 | :type 'symbol)
47 |
48 | (defun lsp-erlang-server-start-fun (port)
49 | `(,lsp-erlang-server-path
50 | "--transport" "tcp"
51 | "--port" ,(number-to-string port)))
52 |
53 | (defun lsp-erlang-server-connection ()
54 | (if (eq lsp-erlang-server-connection-type 'tcp)
55 | (lsp-tcp-connection 'lsp-erlang-server-start-fun)
56 | (lsp-stdio-connection `(,lsp-erlang-server-path "--transport" "stdio"))))
57 |
58 | (lsp-register-client
59 | (make-lsp-client :new-connection (lsp-erlang-server-connection)
60 | :major-modes '(erlang-mode)
61 | :priority -1
62 | :server-id 'erlang-ls))
63 |
64 | (provide 'lsp-erlang)
65 | ;;; lsp-erlang.el ends here
66 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | `emacs-lsp` is a very active organization so before you start working on
4 | a feature/issue make sure that there is a corresponding issue and drop a
5 | note that you start working on that to avoid collisions.
6 | Feel free to ping the maintainers in [Discord](https://discord.gg/Wrqrf42f2h)
7 | chat or in the issue report if you need help/clarification on how things work.
8 |
9 | If you discover issues, have ideas for improvements or new features,
10 | please report them to the [issue tracker][1] of the repository or
11 | submit a pull request. Please, try to follow these guidelines when you
12 | do so.
13 |
14 | ## Issue reporting
15 |
16 | * Check that the issue has not already been reported.
17 | * Check that the issue has not already been fixed in the latest code
18 | (a.k.a. `master`).
19 | * Be clear, concise and precise in your description of the problem.
20 | * Open an issue with a descriptive title and a summary in grammatically correct,
21 | complete sentences.
22 | * Mention your Emacs version and operating system.
23 | * Mention the lsp-mode and related packages version info.
24 | * Include any relevant code to the issue summary.
25 |
26 | ### Reporting bugs
27 |
28 | When reporting bugs it's a good idea to go through the [Troubleshooting section
29 | of the documentation][7]. Adding information like the backtrace and the *lsp-log* buffer to
30 | the bug report makes it easier to track down bugs. Some steps to reproduce a bug
31 | reliably would also make a huge difference.
32 |
33 | ## Pull requests
34 |
35 | * Read [how to properly contribute to open source projects on Github][2].
36 | * Use the same coding conventions as the rest of the project.
37 | * Make sure that the unit tests are passing locally via `make test` or via the CI.
38 | * Write [good commit messages][3].
39 | * Update the [changelog][6].
40 | * Code-style/formatting changes and typo-fixes should go into their own commits and put into the `.git-blame-ignore-revs` file to avoid thrashing the `git blame` data.
41 |
42 | [1]: https://github.com/emacs-lsp/lsp-mode/issues
43 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
44 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
45 | [4]: https://github.com/emacs-lsp/lsp-mode/blob/master/CHANGELOG.md
46 | [5]: https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/
47 |
--------------------------------------------------------------------------------
/clients/lsp-groovy.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-groovy.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, groovy
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Groovy Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 | (require 'f)
29 |
30 | (defgroup lsp-groovy nil
31 | "LSP support for Groovy, using groovy-language-server."
32 | :group 'lsp-mode
33 | :link '(url-link "https://github.com/prominic/groovy-language-server"))
34 |
35 | (defcustom lsp-groovy-server-file (f-join lsp-server-install-dir "groovy-language-server-all.jar")
36 | "JAR file path for groovy-language-server-all.jar."
37 | :group 'lsp-groovy
38 | :risky t
39 | :type 'file)
40 |
41 | (defun lsp-groovy--lsp-command ()
42 | "Generate LSP startup command."
43 | `("java" "-jar" ,(expand-file-name lsp-groovy-server-file)))
44 |
45 | (defcustom lsp-groovy-classpath ["/usr/local/opt/groovy/libexec/lib"]
46 | "List of paths to Groovy JARs."
47 | :group 'lsp-groovy
48 | :risky t
49 | :type 'lsp-string-vector)
50 |
51 | (lsp-register-custom-settings
52 | '(("groovy.classpath" lsp-groovy-classpath)))
53 |
54 | (lsp-register-client
55 | (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-groovy--lsp-command)
56 | :major-modes '(groovy-mode)
57 | :priority -1
58 | :server-id 'groovy-ls
59 | :initialized-fn (lambda (workspace)
60 | (with-lsp-workspace workspace
61 | (lsp--set-configuration (lsp-configuration-section "groovy"))))))
62 |
63 | (provide 'lsp-groovy)
64 | ;;; lsp-groovy.el ends here
65 |
--------------------------------------------------------------------------------
/clients/lsp-tex.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-tex.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, tex
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Tex Typesetting Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-tex nil
30 | "LSP support for TeX and friends, using Digestif and texlab."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/astoff/digestif/")
33 | :link '(url-link "https://github.com/latex-lsp/texlab"))
34 |
35 | (defcustom lsp-tex-server 'texlab
36 | "Choose LSP tex server."
37 | :type '(choice (const :tag "texlab" texlab)
38 | (const :tag "digestif" digestif))
39 | :group 'lsp-tex)
40 |
41 | (defcustom lsp-clients-digestif-executable "digestif"
42 | "Command to start the Digestif language server."
43 | :group 'lsp-tex
44 | :risky t
45 | :type 'file)
46 |
47 | (lsp-register-client
48 | (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-digestif-executable)
49 | :major-modes '(plain-tex-mode latex-mode)
50 | :priority (if (eq lsp-tex-server 'digestif) 1 -1)
51 | :server-id 'digestif))
52 |
53 | (defcustom lsp-clients-texlab-executable "texlab"
54 | "Command to start the texlab language server."
55 | :group 'lsp-tex
56 | :risky t
57 | :type 'file)
58 |
59 | (lsp-register-client
60 | (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-texlab-executable)
61 | :major-modes '(plain-tex-mode latex-mode)
62 | :priority (if (eq lsp-tex-server 'texlab) 1 -1)
63 | :server-id 'texlab))
64 |
65 | (provide 'lsp-tex)
66 | ;;; lsp-tex.el ends here
67 |
--------------------------------------------------------------------------------
/scripts/lsp-start-plain.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-start-plain.el --- LSP mode quick starter -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2018 Ivan Yonchovski
4 |
5 | ;; Author: Zhu Zihao
6 | ;; Keywords: languages
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; This file is a helper to start a minimal lsp environment.
24 | ;; To use this, start your Emacs with "emacs -q" and load this file.
25 |
26 | ;; It will install `lsp-mode', `lsp-ui' with their dependencies to start a
27 | ;; minimal lsp environment.
28 |
29 | ;; And it forces Emacs to load `.el' files rather than `.elc' files
30 | ;; for more readable backtrace.
31 |
32 | ;;; Code:
33 |
34 | (require 'package)
35 |
36 | (setq debug-on-error t)
37 |
38 | (let* ((package-archives '(("melpa" . "https://melpa.org/packages/")
39 | ("gnu" . "https://elpa.gnu.org/packages/")))
40 | (no-byte-compile t)
41 | (package-user-dir (expand-file-name (make-temp-name "lsp-tmp-elpa")
42 | user-emacs-directory))
43 | (custom-file (expand-file-name "custom.el" package-user-dir))
44 | (pkg-list '(lsp-mode lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs dap-mode lsp-origami lsp-dart company flycheck lsp-pyright)))
45 |
46 | (package-initialize)
47 | (package-refresh-contents)
48 |
49 | (mapcar (lambda (pkg)
50 | (unless (package-installed-p pkg)
51 | (package-install pkg))
52 | (require pkg))
53 | pkg-list)
54 |
55 | (yas-global-mode)
56 | (add-hook 'prog-mode-hook 'lsp)
57 | (add-hook 'kill-emacs-hook `(lambda ()
58 | (delete-directory ,package-user-dir t))))
59 |
60 | (provide 'lsp-start-plain)
61 | ;;; lsp-start-plain.el ends here
62 |
--------------------------------------------------------------------------------
/clients/lsp-purescript.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-purescript.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, purescript
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the PureScript Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-purescript nil
30 | "LSP support for PureScript, using purescript-language-server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/nwolverson/purescript-language-server"))
33 |
34 | (defcustom lsp-purescript-server-executable nil
35 | "Path to server executable."
36 | :type 'string
37 | :risky t
38 | :group 'lsp-purescript)
39 |
40 | (defcustom lsp-purescript-server-args
41 | '("--stdio")
42 | "Arguments to pass to the server."
43 | :type '(repeat string)
44 | :risky t
45 | :group 'lsp-purescript)
46 |
47 | (defun lsp-purescript--server-command ()
48 | "Generate LSP startup command for purescript-language-server."
49 | (cons (or lsp-purescript-server-executable
50 | (lsp-package-path 'purescript-language-server))
51 | lsp-purescript-server-args))
52 |
53 | (lsp-dependency 'purescript-language-server
54 | '(:system "purescript-language-server")
55 | '(:npm :package "purescript-language-server"
56 | :path "purescript-language-server"))
57 |
58 | (lsp-register-client
59 | (make-lsp-client
60 | :new-connection (lsp-stdio-connection
61 | #'lsp-purescript--server-command)
62 | :major-modes '(purescript-mode)
63 | :priority -1
64 | :server-id 'pursls
65 | :download-server-fn (lambda (_client callback error-callback _update?)
66 | (lsp-package-ensure 'purescript-language-server callback error-callback))))
67 |
68 |
69 | (provide 'lsp-purescript)
70 | ;;; lsp-purescript.el ends here
71 |
--------------------------------------------------------------------------------
/clients/lsp-dockerfile.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-dockerfile.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, dockerfile
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for Dockerfile documents.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 |
30 | ;;; Dockerfile
31 |
32 | (defgroup lsp-dockerfile nil
33 | "Dockerfile LSP client, provided by the Dockerfile Language Server."
34 | :group 'lsp-mode
35 | :version "7.1"
36 | :link '(url-link "https://github.com/rcjsuen/dockerfile-language-server-nodejs"))
37 |
38 | (defcustom lsp-dockerfile-language-server-command
39 | '("docker-langserver" "--stdio")
40 | "The command that starts the docker language server."
41 | :group 'lsp-dockerfile
42 | :type '(repeat :tag "List of string values" string))
43 |
44 | (lsp-dependency 'docker-langserver
45 | '(:system "docker-langserver")
46 | '(:npm :package "dockerfile-language-server-nodejs"
47 | :path "docker-langserver"))
48 |
49 | (lsp-register-client
50 | (make-lsp-client :new-connection (lsp-stdio-connection
51 | (lambda ()
52 | `(,(or (executable-find
53 | (cl-first lsp-dockerfile-language-server-command))
54 | (lsp-package-path 'docker-langserver))
55 | ,@(cl-rest lsp-dockerfile-language-server-command))))
56 | :major-modes '(dockerfile-mode)
57 | :priority -1
58 | :server-id 'dockerfile-ls
59 | :download-server-fn (lambda (_client callback error-callback _update?)
60 | (lsp-package-ensure 'docker-langserver
61 | callback error-callback))))
62 |
63 | (provide 'lsp-dockerfile)
64 | ;;; lsp-dockerfile.el ends here
65 |
--------------------------------------------------------------------------------
/clients/lsp-ada.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-ada.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, ada
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Ada Programming Language
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-ada nil
30 | "Settings for Ada Language Server."
31 | :group 'tools
32 | :tag "Language Server"
33 | :package-version '(lsp-mode . "6.2"))
34 |
35 | (defcustom lsp-ada-project-file "default.gpr"
36 | "Set the project file full path to configure the language server with.
37 | The ~ prefix (for the user home directory) is supported.
38 | See https://github.com/AdaCore/ada_language_server for a per-project
39 | configuration example."
40 | :type 'string
41 | :group 'lsp-ada
42 | :package-version '(lsp-mode . "6.2"))
43 |
44 | (defcustom lsp-ada-option-charset "UTF-8"
45 | "The charset to use by the Ada Language server. Defaults to 'UTF-8'."
46 | :type 'string
47 | :group 'lsp-ada
48 | :package-version '(lsp-mode . "6.2"))
49 |
50 | (defcustom lsp-ada-enable-diagnostics t
51 | "A boolean to disable diagnostics. Defaults to true."
52 | :type 'boolean
53 | :group 'lsp-ada
54 | :package-version '(lsp-mode . "6.2"))
55 |
56 | (lsp-register-custom-settings
57 | '(("ada.projectFile" lsp-ada-project-file)
58 | ("ada.enableDiagnostics" lsp-ada-enable-diagnostics)
59 | ("ada.defaultCharset" lsp-ada-option-charset)))
60 |
61 | (lsp-register-client
62 | (make-lsp-client :new-connection (lsp-stdio-connection '("ada_language_server"))
63 | :major-modes '(ada-mode)
64 | :priority -1
65 | :initialized-fn (lambda (workspace)
66 | (with-lsp-workspace workspace
67 | (lsp--set-configuration
68 | (lsp-configuration-section "ada"))))
69 | :server-id 'ada-ls))
70 |
71 | (provide 'lsp-ada)
72 | ;;; lsp-ada.el ends here
73 |
--------------------------------------------------------------------------------
/clients/lsp-racket.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-racket.el --- lsp-mode racket integration -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 lsp-mode maintainers
4 |
5 | ;; Author: lsp-mode maintainers
6 | ;; Keywords: languages
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; Client for the Racket language server.
24 |
25 | ;;; Code:
26 |
27 | (require 'ht)
28 | (require 'lsp-mode)
29 |
30 |
31 | ;; racket-langserver
32 |
33 | (defgroup lsp-racket-langserver nil
34 | "LSP support for Racket, using racket-langserver"
35 | :group 'lsp-mode
36 | :link '(url-link "https://github.com/jeapostrophe/racket-langserver"))
37 |
38 | (defcustom lsp-racket-langserver-command '("racket" "--lib" "racket-langserver")
39 | "Command to start the server."
40 | :type 'string
41 | :package-version '(lsp-mode . "7.1"))
42 |
43 | (lsp-register-client
44 | (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-racket-langserver-command))
45 | :major-modes '(racket-mode)
46 | :priority 1
47 | :server-id 'racket-langserver))
48 |
49 |
50 | ;; Theia
51 |
52 | (defgroup lsp-racket-language-server nil
53 | "LSP support for Racket, using racket-language-server."
54 | :group 'lsp-mode
55 | :link '(url-link "https://github.com/theia-ide/racket-language-server"))
56 |
57 | (defcustom lsp-racket-language-server-path "racket-language-server"
58 | "Executable path for the server."
59 | :type 'string
60 | :package-version '(lsp-mode . "7.1"))
61 |
62 | (defun lsp-racket-language-server-colorize-handler (&rest _args)
63 | "Handler for the colorize notification."
64 | ;; TODO:
65 | nil)
66 |
67 | (lsp-register-client
68 | (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-racket-language-server-path))
69 | :major-modes '(racket-mode)
70 | :priority -1
71 | :notification-handlers (ht ("racket/colorize" #'lsp-racket-language-server-colorize-handler))
72 | :server-id 'racket-language-server))
73 |
74 | (provide 'lsp-racket)
75 | ;;; lsp-racket.el ends here
76 |
--------------------------------------------------------------------------------
/docs/manual-language-docs/lsp-rust.md:
--------------------------------------------------------------------------------
1 | ## Server note
2 |
3 | NOTE: If you are using `rustic-mode`, you have to change `rustic-lsp-server` instead of `lsp-rust-server`, since it also supports eglot as a lightweight alternative to lsp-mode.
4 |
5 | - `lsp-rust-server` Choose LSP server (default is RLS)
6 |
7 | - `lsp-rust-switch-server` Switch priorities of lsp servers
8 |
9 | ## RLS
10 |
11 | ### Customization
12 |
13 | This is an incomplete list of the available options
14 |
15 | - `lsp-rust-rls-server-command` change command to start RLS
16 |
17 | - `lsp-rust-show-hover-context` turn off hover tooltips
18 |
19 | ## rustfmt
20 |
21 | Code formatting with [rustfmt](https://github.com/rust-lang/rustfmt) can be configured with:
22 |
23 | `lsp-rust-rustfmt-path` change default path for rustfmt executable
24 |
25 | To enable automatic code format on save, add this to your `init.el` (`rust-mode` is assumed to be installed):
26 |
27 | ```
28 | (add-hook 'before-save-hook (lambda () (when (eq 'rust-mode major-mode)
29 | (lsp-format-buffer))))
30 | ```
31 |
32 | ## rust-analyzer
33 |
34 | ### Commands
35 |
36 | #### `lsp-rust-analyzer-syntax-tree`
37 |
38 | Display syntax tree for current buffer
39 |
40 | 
41 |
42 | #### `lsp-rust-analyzer-status`
43 |
44 | Display status information for rust-analyzer
45 |
46 | 
47 |
48 | #### `lsp-rust-analyzer-join-lines`
49 |
50 | Join selected lines into one, smartly fixing up whitespace and trailing commas
51 |
52 | before:
53 |
54 | 
55 |
56 | after:
57 |
58 | 
59 |
60 | ### inlay-hints
61 |
62 | `lsp-rust-analyzer-inlay-hints-mode` enables displaying of inlay hints
63 |
64 | NOTE: the inlay hints interact badly with the lsp-ui sideline, because it doesn't seem to consider the overlays in its width calculation, which often leads to lines wrapping around.
65 |
66 | 
67 |
68 | ### Macro expansion
69 |
70 | `lsp-rust-analyzer-expand-macro` expand macro call at point recursively
71 |
72 | Use your own function for displaying macro expansion by customizing `lsp-rust-analyzer-macro-expansion-method`
73 |
74 | Formatted and highlighted result with the default function of rustic.
75 |
76 | 
77 |
78 | ### auto-import
79 |
80 | Get a list of possible auto import candidates with `lsp-execute-code-action`
81 |
82 | 
83 |
84 | ### Caveats
85 |
86 | - Rust Analyzer does not support disabling snippets - https://github.com/rust-analyzer/rust-analyzer/issues/2518
87 |
88 | ### extract signature
89 |
90 | This [unmerged PR](https://github.com/emacs-lsp/lsp-mode/pull/1740) contains an example method that allows
91 | modifying the signature that is displayed by eldoc.
92 |
--------------------------------------------------------------------------------
/clients/lsp-ocaml.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-ocaml.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, ocaml
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Ocaml Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-ocaml nil
30 | "LSP support for OCaml, using ocaml-language-server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/freebroccolo/ocaml-language-server"))
33 |
34 | (define-obsolete-variable-alias
35 | 'lsp-ocaml-ocaml-lang-server-command
36 | 'lsp-ocaml-lang-server-command
37 | "lsp-mode 6.1")
38 |
39 | (defcustom lsp-ocaml-lang-server-command
40 | '("ocaml-language-server" "--stdio")
41 | "Command to start ocaml-language-server."
42 | :group 'lsp-ocaml
43 | :type '(choice
44 | (string :tag "Single string value")
45 | (repeat :tag "List of string values"
46 | string)))
47 |
48 | (lsp-register-client
49 | (make-lsp-client :new-connection (lsp-stdio-connection
50 | (lambda () lsp-ocaml-lang-server-command))
51 | :major-modes '(reason-mode caml-mode tuareg-mode)
52 | :priority -1
53 | :server-id 'ocaml-ls))
54 |
55 | (defgroup lsp-ocaml-lsp-server nil
56 | "LSP support for OCaml, using ocaml-lsp-server."
57 | :group 'lsp-mode
58 | :link '(url-link "https://github.com/ocaml/ocaml-lsp"))
59 |
60 | (define-obsolete-variable-alias 'lsp-merlin 'lsp-ocaml-lsp-server "lsp-mode 6.1")
61 | (define-obsolete-variable-alias 'lsp-merlin-command 'lsp-ocaml-lsp-server-command "lsp-mode 6.1")
62 |
63 | (defcustom lsp-ocaml-lsp-server-command
64 | '("ocamllsp")
65 | "Command to start ocaml-language-server."
66 | :group 'lsp-ocaml
67 | :type '(choice
68 | (string :tag "Single string value")
69 | (repeat :tag "List of string values"
70 | string)))
71 |
72 | (lsp-register-client
73 | (make-lsp-client
74 | :new-connection
75 | (lsp-stdio-connection (lambda () lsp-ocaml-lsp-server-command))
76 | :major-modes '(caml-mode tuareg-mode)
77 | :priority 0
78 | :server-id 'ocaml-lsp-server))
79 |
80 |
81 | (provide 'lsp-ocaml)
82 | ;;; lsp-ocaml.el ends here
83 |
--------------------------------------------------------------------------------
/docs/page/faq.md:
--------------------------------------------------------------------------------
1 | # FAQ
2 |
3 | - How do I troubleshoot `"Server FOO-LS:pid exited with status signal. Do you want to restart it? (y or n)"`?
4 | - This message indicates that the language server has crashed for some reason. You may check the server stderr which is `*FOO-LS::stderr*`. If you get this try to run the exact command that `lsp-mode` is running in the terminal. You may find it in `*lsp-log*` buffer.
5 | - How to configure a server with local variables?
6 | - Add `lsp` server call to `hack-local-variables-hook` which runs right after the local variables are loaded.
7 | ```elisp
8 | (add-hook 'hack-local-variables-hook
9 | (lambda () (when (derived-mode-p 'XXX-mode) (lsp))))
10 | ```
11 | - I have multiple language servers registered for language FOO. Which one will be used when opening a project?
12 | - The one with highest priority wins. `lsp-clients.el` predefined servers have priority -1, lower than external packages (priority 0 if unspecified). If a server is registered with `:add-on?` flag set to `t` it will be started in parallel to the other servers that are registered for the current mode.
13 | - I have multiple language servers for language `FOO` and I want to select the server per project, what can I do?
14 | - You may create `dir-local` for each of the projects and specify list of `lsp-enabled-clients`. This will narrow the list of the clients that are going to be tested for the project.
15 | - The completion does not work fine and inserts arguments and placeholders, what I am doing wrong?
16 | - make sure you have installed `yasnippet` and you have `yasnippet` minor mode enabled.
17 | - I am getting "Package ‘spinner-1.7.3’ is unavailable" when trying to install `lsp-mode`.
18 | - This is caused by GPG keys used by the ELPA package manager not being up to date. You may fix by installing: [gnu-elpa-keyring-update](https://elpa.gnu.org/packages/gnu-elpa-keyring-update.html)
19 | - The flycheck does not work in `typescript`, `html` and `javascript` blocks in `vue-mode`. How to fix that?
20 | - This is caused by the fact that `vue-mode` uses multiple major modes in single file and the `lsp-ui` checker may not associated with the major mode at point. You could fix that by adding the following lines to your config.
21 | ```elisp
22 | (with-eval-after-load 'lsp-mode
23 | (mapc #'lsp-flycheck-add-mode '(typescript-mode js-mode css-mode vue-html-mode)))
24 | ```
25 | - I have disabled snippets and `Rust Analyzer` server inserts redundant `$0` when performing completion?
26 | - `Rust Analyzer` does not support disabling snippets - see
27 | - How do I force `lsp-mode` to forget the workspace folders for multi root
28 | servers so the workspace folders are added on demand?
29 | - Use the following snippet:
30 | ``` elisp
31 | (advice-add 'lsp :before (lambda (&rest _args) (eval '(setf (lsp-session-server-id->folders (lsp-session)) (ht)))))
32 | ```
33 |
--------------------------------------------------------------------------------
/lsp-iedit.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-iedit.el --- `iedit' integration -*- lexical-binding: t -*-
2 | ;;
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 | ;;
5 | ;; This program is free software; you can redistribute it and/or modify
6 | ;; it under the terms of the GNU General Public License as published by
7 | ;; the Free Software Foundation, either version 3 of the License, or
8 | ;; (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program. If not, see .
17 |
18 | ;;; Commentary:
19 |
20 | ;; This module provides features that allow starting `iedit' on various
21 | ;; different lsp-based, semantic units (like documentHighlights, and
22 | ;; linkedEditingRanges in the future).
23 |
24 | ;;; Code:
25 |
26 | (require 'lsp-mode)
27 |
28 | (declare-function iedit-make-occurrence-overlay "iedit-lib" (begin end))
29 | (declare-function iedit-start-buffering "iedit-lib" ())
30 |
31 | (defvar iedit-mode)
32 | (defvar iedit-auto-buffering)
33 | (defvar iedit-occurrences-overlays)
34 |
35 | (defun lsp-iedit--on-ranges (ranges)
36 | "Start an `iedit' operation using RANGES.
37 | RANGES shall be a list of lsp-`&Range's. They can be acquired
38 | from various lsp protocol requests, e.g.
39 | `textDocument/documentHighlight', ...."
40 | (require 'iedit)
41 | (unless (seq-empty-p ranges)
42 | (mapc (-lambda ((&RangeToPoint :start :end))
43 | (push (iedit-make-occurrence-overlay start end)
44 | iedit-occurrences-overlays))
45 | ranges)
46 | ;; See `iedit-start'; TODO: upstream this
47 | (setq iedit-mode t)
48 | (when iedit-auto-buffering
49 | (iedit-start-buffering))
50 | (run-hooks 'iedit-mode-hook)
51 | (add-hook 'before-revert-hook 'iedit-done nil t)
52 | (add-hook 'kbd-macro-termination-hook 'iedit-done nil t)
53 | (add-hook 'change-major-mode-hook 'iedit-done nil t)
54 | (add-hook 'iedit-aborting-hook 'iedit-done nil t)
55 | (message "%d occurrences of \"%s\""
56 | (seq-length ranges)
57 | (lsp--range-text (lsp-seq-first ranges)))))
58 |
59 | ;;;###autoload
60 | (defun lsp-iedit-highlights ()
61 | "Start an `iedit' operation on the documentHighlights at point.
62 | This can be used as a primitive `lsp-rename' replacement if the
63 | language server doesn't support renaming.
64 |
65 | See also `lsp-enable-symbol-highlighting'."
66 | (interactive)
67 | (let ((highlights (lsp-request "textDocument/documentHighlight"
68 | (lsp--text-document-position-params))))
69 | (lsp-iedit--on-ranges (mapcar #'lsp:document-highlight-range highlights))))
70 |
71 | (provide 'lsp-iedit)
72 | ;;; lsp-iedit.el ends here
73 |
--------------------------------------------------------------------------------
/clients/lsp-angular.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-angular.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp,
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Angular Web application framework.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 | (require 'f)
29 |
30 |
31 | ;;; Angular
32 | (defgroup lsp-angular nil
33 | "Angular LSP client, provided by the Angular Language Service Server."
34 | :group 'lsp-mode
35 | :version "7.1"
36 | :link '(url-link "https://github.com/angular/vscode-ng-language-service"))
37 |
38 | (defcustom lsp-clients-angular-language-server-command
39 | '("node"
40 | "/usr/lib/node_modules/@angular/language-server"
41 | "--ngProbeLocations"
42 | "/usr/lib/node_modules"
43 | "--tsProbeLocations"
44 | "/usr/lib/node_modules"
45 | "--stdio")
46 | "The command that starts the angular language server."
47 | :group 'lsp-angular
48 | :type '(choice
49 | (string :tag "Single string value")
50 | (repeat :tag "List of string values"
51 | string)))
52 |
53 | (defun lsp-client--angular-start-loading (_workspace params)
54 | (lsp--info "Started loading project %s" params))
55 |
56 | (defun lsp-client--angular-finished-loading (_workspace params)
57 | (lsp--info "Finished loading project %s" params))
58 |
59 | (lsp-register-client
60 | (make-lsp-client :new-connection (lsp-stdio-connection
61 | (lambda () lsp-clients-angular-language-server-command))
62 | :activation-fn (lambda (&rest _args)
63 | (and (string-match-p "\\.html\\'" (buffer-file-name))
64 | (lsp-workspace-root)
65 | (file-exists-p (f-join (lsp-workspace-root) "angular.json"))))
66 | :priority -1
67 | :notification-handlers (ht ("angular/projectLoadingStart" #'lsp-client--angular-start-loading)
68 | ("angular/projectLoadingFinish" #'lsp-client--angular-finished-loading))
69 | :add-on? t
70 | :server-id 'angular-ls))
71 |
72 |
73 | (provide 'lsp-angular)
74 | ;;; lsp-angular.el ends here
75 |
--------------------------------------------------------------------------------
/clients/lsp-bash.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-bash.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, bash, shell-script
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Bash Programming Language
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | ;;; Bash
30 | (defgroup lsp-bash nil
31 | "Settings for the Bash Language Server."
32 | :group 'lsp-mode
33 | :tag "Language Server"
34 | :package-version '(lsp-mode . "6.2"))
35 |
36 | (defcustom lsp-bash-explainshell-endpoint nil
37 | "The endpoint to use explainshell.com to answer 'onHover' queries.
38 | See instructions at https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode"
39 | :type 'string
40 | :risky t
41 | :group 'lsp-bash
42 | :package-version '(lsp-mode . "6.2"))
43 |
44 | (defcustom lsp-bash-highlight-parsing-errors nil
45 | "Consider parsing errors in scripts as 'problems'."
46 | :type 'boolean
47 | :group 'lsp-bash
48 | :package-version '(lsp-mode . "6.2"))
49 |
50 | (defcustom lsp-bash-glob-pattern nil
51 | "Glob pattern used to find shell script files to parse."
52 | :type 'string
53 | :group 'lsp-bash
54 | :package-version '(lsp-mode . "6.3"))
55 |
56 | (defun lsp-bash--bash-ls-server-command ()
57 | "Startup command for Bash language server."
58 | (list (lsp-package-path 'bash-language-server) "start"))
59 |
60 | (lsp-dependency 'bash-language-server
61 | '(:system "bash-language-server")
62 | '(:npm :package "bash-language-server"
63 | :path "bash-language-server"))
64 |
65 | (lsp-register-client
66 | (make-lsp-client
67 | :new-connection (lsp-stdio-connection #'lsp-bash--bash-ls-server-command)
68 | :major-modes '(sh-mode)
69 | :priority -1
70 | :environment-fn (lambda ()
71 | '(("EXPLAINSHELL_ENDPOINT" . lsp-bash-explainshell-endpoint)
72 | ("HIGHLIGHT_PARSING_ERRORS" . lsp-bash-highlight-parsing-errors)
73 | ("GLOB_PATTERN" . lsp-bash-glob-pattern)))
74 | :server-id 'bash-ls
75 | :download-server-fn (lambda (_client callback error-callback _update?)
76 | (lsp-package-ensure 'bash-language-server callback error-callback))))
77 |
78 | (provide 'lsp-bash)
79 | ;;; lsp-bash.el ends here
80 |
--------------------------------------------------------------------------------
/test/lsp-benchmarks.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-benchmarks.el --- lsp benchmarks -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019
4 |
5 | ;; Author: Ivan Yonchovski
6 | ;; Keywords:
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;;
24 |
25 | ;;; Code:
26 | (require 'lsp-mode)
27 | (defvar lsp-benchmark--test-results nil)
28 | (defvar lsp-benchmark-process (make-process :command '("ls")
29 | :name "xx"
30 | :buffer "xx"))
31 | (defun lsp-benchmarks--create-process-message ()
32 | (let ((fn (lsp--create-filter-function nil)))
33 | (lambda (input)
34 | (flet ((lsp--parser-on-message (msg _workspace)
35 | (push msg lsp-benchmark--test-results)))
36 | (funcall fn lsp-benchmark-process input)
37 | (prog1 lsp-benchmark--test-results
38 | (setq lsp-benchmark--test-results nil))))))
39 |
40 | (defvar lsp-benchmark-function (lsp-benchmarks--create-process-message))
41 | (defvar lsp-benchmark-data (--map (s-replace "\n" "\r\n" it)
42 | (lsp--read-from-file "fixtures/requests")))
43 | ;; (-take 1 lsp-benchmark-data)
44 | ;; (funcall lsp-benchmark-function (first lsp-benchmark-data))
45 |
46 | ;; (progn
47 | ;; ;; (profiler-start 'cpu)
48 | ;; (let ((gc-cons-threshold 10000000000))
49 |
50 | ;; (profiler-stop)
51 | ;; (profiler-start 'cpu)
52 | ;; (dotimes (_ 100)(mapc (lambda (it) (funcall lsp-benchmark-function it))
53 | ;; lsp-benchmark-data))
54 |
55 | ;; (profiler-report)
56 | ;; (garbage-collect)))
57 |
58 | ;; (progn
59 | ;; ;; (profiler-start 'cpu)
60 | ;; (profiler-stop)
61 | ;; (profiler-start 'cpu)
62 | ;; (benchmark-run 10 (mapc (lambda (it) (funcall lsp-benchmark-function it))
63 | ;; lsp-benchmark-data))
64 | ;; (profiler-report))
65 | ;; ;; (funcall lsp-benchmark-function )
66 |
67 | ;; ;;; lsp-benchmarks.el ends here
68 | ;; (benchmark-run 10 (mapc (lambda (it) (funcall lsp-benchmark-function it))
69 | ;; lsp-benchmark-data))
70 | ;; ;;
71 | ;;
72 |
73 | (let ((gc-cons-threshold 10000000000))
74 | (prog1 (benchmark-run 10
75 | (mapc (lambda (it) (funcall lsp-benchmark-function it))
76 | lsp-benchmark-data))
77 | (garbage-collect)))
78 |
79 | (provide 'lsp-benchmarks)
80 |
--------------------------------------------------------------------------------
/test/lsp-clangd-test.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-clangd-test.el --- unit tests for clangd -*- lexical-binding: t -*-
2 |
3 | ;; Copyright (C) 2019 Daniel Martín .
4 |
5 | ;; This program is free software: you can redistribute it and/or modify
6 | ;; it under the terms of the GNU General Public License as published by
7 | ;; the Free Software Foundation, either version 3 of the License, or
8 | ;; (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program. If not, see .
17 |
18 | ;;; Commentary:
19 |
20 | ;; Unit tests for Clangd servers.
21 |
22 | ;;; Code:
23 |
24 | (require 'ert)
25 | (require 'lsp-clangd)
26 |
27 | (ert-deftest lsp-clangd-extract-signature-on-hover ()
28 | (should (string= (lsp-clients-extract-signature-on-hover
29 | (lsp-make-markup-content :kind lsp/markup-kind-markdown
30 | :value "Sample\n ```cpp\n// In Function.hpp\nvoid function(int n);\n```")
31 | 'clangd)
32 | "void function(int n);"))
33 | (should (string= (lsp-clients-extract-signature-on-hover
34 | (lsp-make-markup-content :kind lsp/markup-kind-markdown
35 | :value "Sample\n ```cpp\nvoid function(int n);\n```")
36 | 'clangd)
37 | "void function(int n);"))
38 | (should (string= (lsp-clients-extract-signature-on-hover
39 | (lsp-make-markup-content :kind lsp/markup-kind-markdown
40 | :value "Sample\n ```cpp\n void function(int n);\n```")
41 | 'clangd)
42 | "void function(int n);"))
43 | (should-error (lsp-clients-extract-signature-on-hover
44 | (lsp-make-markup-content :value "Wrong")
45 | 'clangd)))
46 |
47 | (ert-deftest lsp-clients-join-region ()
48 | (with-temp-buffer
49 | (insert "void function(int n);")
50 | (should (string= (lsp-clangd-join-region (point-min) (point-max)) "void function(int n);"))
51 | (erase-buffer)
52 | (insert " void function(int n);")
53 | (should (string= (lsp-clangd-join-region (point-min) (point-max)) "void function(int n);"))
54 | (erase-buffer)
55 | (insert "void foo(int n,
56 | int p,
57 | int k);")
58 | (should (string= (lsp-clangd-join-region (point-min) (point-max)) "void foo(int n, int p, int k);"))
59 | (erase-buffer)
60 | (insert "void foo(int n,
61 | int p,
62 | int k);")
63 | (should (string= (lsp-clangd-join-region (point-min) (point-max)) "void foo(int n, int p, int k);"))))
64 |
65 | ;;; lsp-clangd-test.el ends here
66 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SHELL := /usr/bin/env bash
2 |
3 | EMACS ?= emacs
4 | CASK ?= cask
5 |
6 | INIT="(progn \
7 | (require 'package) \
8 | (push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \
9 | (package-initialize) \
10 | (package-refresh-contents))"
11 |
12 | LINT="(progn \
13 | (unless (package-installed-p 'package-lint) \
14 | (package-install 'package-lint)) \
15 | (require 'package-lint) \
16 | (package-lint-batch-and-exit))"
17 |
18 | LSP-FILES := lsp-protocol.el lsp-mode.el lsp.el lsp-completion.el \
19 | lsp-diagnostics.el lsp-lens.el lsp-modeline.el \
20 | $(wildcard clients/*.el)
21 |
22 | TEST-FILES := test/windows-bootstrap.el test/test-helper.el \
23 | $(shell ls test/lsp-*.el)
24 | LOAD-FILE = -l $(test-file)
25 | LOAD-TEST-FILES := $(foreach test-file, $(TEST-FILES), $(LOAD-FILE))
26 |
27 | all:
28 | $(CASK) build
29 |
30 | unix-build:
31 | $(CASK) install
32 |
33 | # TODO: add 'checkdoc' and 'lint' here when they pass
34 | unix-ci: clean unix-build unix-compile unix-test
35 |
36 | windows-ci: CASK=
37 | windows-ci: clean windows-compile windows-test
38 |
39 | unix-compile:
40 | @echo "Compiling..."
41 | @$(CASK) $(EMACS) -Q --batch \
42 | -L . -L clients \
43 | --eval '(setq byte-compile-error-on-warn t)' \
44 | -f batch-byte-compile $(LSP-FILES)
45 |
46 | windows-compile:
47 | @echo "Compiling..."
48 | @$(CASK) $(EMACS) -Q --batch \
49 | -l test/windows-bootstrap.el \
50 | -L . -L clients \
51 | --eval '(setq byte-compile-error-on-warn t)' \
52 | -f batch-byte-compile $(LSP-FILES)
53 |
54 | checkdoc:
55 | $(eval LOG := $(shell mktemp -d)/checklog.log)
56 | @touch $(LOG)
57 |
58 | @echo "checking doc..."
59 |
60 | @for f in $(LSP-FILES); do \
61 | $(CASK) $(EMACS) -Q --batch \
62 | --eval "(checkdoc-file \"$$f\")" \
63 | 2>&1 | tee -a $(LOG); \
64 | done
65 |
66 | @if [ -s $(LOG) ]; then \
67 | echo ''; \
68 | exit 1; \
69 | else \
70 | echo 'checkdoc ok!'; \
71 | fi
72 |
73 | lint:
74 | @echo "package linting..."
75 | @$(CASK) $(EMACS) -Q --batch \
76 | -L . -L clients \
77 | --eval $(INIT) \
78 | --eval $(LINT) \
79 | $(LSP-FILES)
80 |
81 | unix-test:
82 | $(CASK) exec ert-runner -L . -L clients -t '!no-win' -t '!org'
83 |
84 | windows-test:
85 | @$(EMACS) -Q --batch \
86 | -l test/windows-bootstrap.el \
87 | -L . -L clients \
88 | $(LOAD-TEST-FILES) \
89 | --eval "(ert-run-tests-batch-and-exit \
90 | '(and (not (tag no-win)) (not (tag org))))"
91 |
92 | docs:
93 | make -C docs/ generate
94 |
95 | local-webpage: docs
96 | cp -rf README.md examples docs
97 | docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/core:2.9 -s CHANGELOG.org -t gfm -o docs/page/CHANGELOG.md
98 | docker login docker.pkg.github.com
99 | docker run --rm -it -p 8000:8000 -v ${PWD}:/docs docker.pkg.github.com/emacs-lsp/docs-image/docs-image
100 |
101 | clean:
102 | rm -rf .cask *.elc clients/*.elc
103 |
104 | .PHONY: all unix-build ci unix-compile windows-compile checkdoc lint unix-test windows-test docs local-webpage clean
105 |
--------------------------------------------------------------------------------
/docs/page/adding-new-language.md:
--------------------------------------------------------------------------------
1 | # Adding support for languages
2 |
3 | ## Registering server
4 |
5 | Here it is the minimal configuration that is needed for new language
6 | server registration. Refer to the documentation of `lsp-mode.el` for
7 | the additional settings supported on registration time.
8 | `lsp-language-id-configuration` must be updated to contain the
9 | corresponding mode -\> language id - in this case `(python-mode .
10 | "python")`
11 |
12 | ``` elisp
13 | (defvar lsp-language-id-configuration
14 | '(...
15 | (python-mode . "python")
16 | ...))
17 | ;; if you are adding the support for your language server in separate repo use
18 | ;; (add-to-list 'lsp-language-id-configuration '(python-mode . "python"))
19 |
20 | (lsp-register-client
21 | (make-lsp-client :new-connection (lsp-stdio-connection "pyls")
22 | :major-modes '(python-mode)
23 | :server-id 'pyls))
24 | ```
25 |
26 | If the language server supports environment variables to control
27 | additional behavior, you can register that by using the
28 | `:environment-fn` function, like the Bash language client does:
29 |
30 | ``` elisp
31 | (lsp-register-client
32 | (make-lsp-client :new-connection (lsp-stdio-connection '("bash-language-server" "start"))
33 | :major-modes '(sh-mode)
34 | :priority -1
35 | :environment-fn (lambda ()
36 | '(("EXPLAINSHELL_ENDPOINT" . lsp-bash-explainshell-endpoint)
37 | ("HIGHLIGHT_PARSING_ERRORS" . lsp-bash-highlight-parsing-errors)))
38 | :server-id 'bash-ls))
39 | ```
40 |
41 | `lsp-bash-explainshell-endpoint` and `lsp-bash-highlight-parsing-errors`
42 | are language client `defcustom` that expose supported server environment
43 | settings in a type-safe way. If you change any of those variables,
44 | restart the language server with `lsp-restart-workspace` for the changes
45 | to be applied.
46 |
47 | ## Sections
48 |
49 | `lsp-mode` provides tools to bridge emacs `defcustom` as a language
50 | configuration sections properties(see [specification
51 | workspace/configuration](https://microsoft.github.io/language-server-protocol/specification#workspace_configuration)).
52 | In addition you may use `lsp-generate-settings` from [Generate Settings
53 | script](https://github.com/emacs-lsp/lsp-mode/blob/master/scripts/lsp-generate-settings.el)
54 | to generate `defcustom` from `package.json` VScode plugin manifest.
55 | Example:
56 |
57 | ``` elisp
58 | (defcustom lsp-foo-language-server-property "bar"
59 | "Demo property."
60 | :group 'foo-ls
61 | :risky t)
62 |
63 | (lsp-register-custom-settings '(("foo.section.property" lsp-foo-language-server-property)))
64 |
65 | (lsp-configuration-section "foo")
66 | ;; => (("foo" ("settings" ("property" . "bar"))))
67 | ```
68 |
69 | ## Documentation
70 |
71 | - Add the new language server to the [lsp-clients.json](https://github.com/emacs-lsp/lsp-mode/blob/master/docs/lsp-clients.json) file sorted by the `full-name` key alphabetically.
72 | - Create a new navigation entry in [mkdocs.yml](https://github.com/emacs-lsp/lsp-mode/blob/master/mkdocs.yml#L4) file.
73 |
74 |
--------------------------------------------------------------------------------
/features/step-definitions/lsp-mode-steps.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-mode-steps.el --- LSP mode steps -*- lexical-binding: t; -*-
2 |
3 | ;; This file contains your project specific step definitions. All
4 | ;; files in this directory whose names end with "-steps.el" will be
5 | ;; loaded automatically by Ecukes.
6 |
7 | (setq lexical-binding t)
8 |
9 | (require 'xref)
10 | (defvar lsp-mode-steps-xref-index nil)
11 |
12 | (defun lsp-steps-xref-goto-xref-item (xref-item func)
13 | "Set buffer and point according to xref-item XREF-ITEM.
14 |
15 | Use FUNC to display buffer."
16 | (with-slots (summary location) xref-item
17 | (let* ((marker (xref-location-marker location))
18 | (buf (marker-buffer marker))
19 | (offset (marker-position marker)))
20 | (with-current-buffer buf
21 | (goto-char offset)
22 | (funcall func buf)))))
23 |
24 | (setq xref-show-xrefs-function (lambda (xrefs _)
25 | (lsp-steps-xref-goto-xref-item (seq-elt xrefs lsp-mode-steps-xref-index) 'switch-to-buffer)))
26 |
27 | (defun lsp-mode-steps--async-call (pred callback)
28 | "Call CALLBACK when PRED becomes true."
29 | (let (timer
30 | (retry-count 0))
31 | (setq timer (run-with-timer
32 | 1
33 | 1
34 | (lambda ()
35 | (if (funcall pred)
36 | (progn
37 | (cancel-timer timer)
38 | (funcall callback))
39 | (setq retry-count (1+ retry-count))
40 | (message "The function failed, attempt %s" retry-count)))))))
41 |
42 | (defmacro lsp-mode-steps-async (form callback)
43 | "Call CALLBACK when FORM becomes true."
44 | `(lsp-mode-steps--async-call (lambda () ,form) ,callback))
45 |
46 | (Given "^I have workspace folder \"\\(.+\\)\"$"
47 | (lambda (folder)
48 | (lsp-workspace-folders-add (f-join lsp-mode-support-path "projects" folder))))
49 |
50 | (And "^I open file \"\\([^\"]+\\)\"$"
51 | (lambda (file)
52 | (find-file (f-join lsp-mode-support-path "projects" file))))
53 |
54 | (And "^I log current line"
55 | (lambda ()
56 | (message "Placed on line %s: %s (point = %s)" (line-number-at-pos) (buffer-substring (point-at-bol)
57 | (point-at-eol))
58 | (point))))
59 |
60 |
61 | (Then "^the \"\\([^\"]+\\)\" status will become \"\\([^\"]+\\)\"$"
62 | (lambda (server-id status callback)
63 | (lsp-mode-steps-async
64 | (eql (lsp--workspace-status (lsp-find-workspace (intern server-id) nil))
65 | (intern status))
66 | callback)))
67 |
68 | (When "^I select item \"\\([^\"]+\\)\" from the next xref call$"
69 | (lambda (arg)
70 | (setq lsp-mode-steps-xref-index (1- (string-to-number arg)))))
71 |
72 | (When "^I goto imenu \"\\([^\"]+\\)\" -> \"\\([^\"]+\\)\"$"
73 | (lambda (type element)
74 | (->> imenu-create-index-function
75 | funcall
76 | (assoc "Function")
77 | cl-rest
78 | (assoc "fn1")
79 | cl-rest
80 | goto-char)))
81 |
--------------------------------------------------------------------------------
/docs/page/settings.md:
--------------------------------------------------------------------------------
1 | Settings
2 | ========
3 |
4 | These are `lsp-mode` specific custom settings:
5 |
6 | - `lsp-log-io` - If non-nil, print all messages to and from the language server to `*lsp-log*`.
7 | - `lsp-print-performance` - If non-nil, print performance info. to `*lsp-log*`.
8 | - `lsp-report-if-no-buffer` - If non nil the errors will be reported even when the file is not open.
9 | - `lsp-keep-workspace-alive` - If non nil keep workspace alive when the last workspace buffer is closed.
10 | - `lsp-enable-snippet` - Enable/disable snippet completion support.
11 | - `lsp-auto-guess-root` - Automatically guess the project root using projectile/project. Do **not** use this setting unless you are familiar with `lsp-mode` internals and you are sure that all of your projects are following `projectile=/=project.el` conventions.
12 | - `lsp-restart` - Defines how server exited event must be handled.
13 | - `lsp-session-file` - File where session information is stored.
14 | - `lsp-auto-configure` - Auto configure `lsp-mode`. When set to `t`, `lsp-mode` will auto-configure `lsp-ui`, `dap-mode` and other settings that makes sense to enable by default.
15 | - `lsp-document-sync-method` - How to sync the document with the language server.
16 | - `lsp-auto-execute-action` - Auto-execute single action.
17 | - `lsp-eldoc-render-all` - Display all of the info returned by `document/onHover`. If this is nil, `eldoc` will show only the symbol information.
18 | - `lsp-enable-completion-at-point` - Enable `completion-at-point` integration.
19 | - `lsp-enable-xref` - Enable xref integration.
20 | - `lsp-diagnostics-provider` - Specifies which package to use for diagnostics. Choose from `:auto`, `:flycheck`, `:flymake` and `:none`. Default is `:auto` which means use `:flycheck` if present and fallback to `:flymake`.
21 | - `lsp-enable-indentation` - Indent regions using the file formatting functionality provided by the language server.
22 | - `lsp-enable-on-type-formatting` - Enable `textDocument/onTypeFormatting` integration.
23 | - `lsp-before-save-edits` - If non-nil, `lsp-mode` will apply edits suggested by the language server before saving a document.
24 | - `lsp-imenu-show-container-name` - Display the symbol's container name in an imenu entry.
25 | - `lsp-imenu-container-name-separator` - Separator string to use to separate the container name from the symbol while displaying imenu entries.
26 | - `lsp-imenu-sort-methods` - How to sort the imenu items. The value is a list of `kind`, `name` or `position`. Priorities are determined by the index of the element.
27 | - `lsp-response-timeout` - Number of seconds to wait for a response from the language server before timing out.
28 | - `lsp-enable-file-watchers` - If non-nil lsp-mode will watch the files in the workspace if the server has requested that.
29 | - `lsp-server-trace` - Request trace mode on the language server.
30 | - `lsp-semantic-tokens-enable` - Enable semantic tokens highlighting support
31 | - `lsp-enable-imenu` - If non-nil, automatically enable imenu integration when server provides `textDocument/documentSymbol`.
32 | - `lsp-signature-auto-activate` - Auto activate signature when trigger conditions are meet.
33 | - `lsp-signature-render-documentation` - Include signature documentation in signature help.
34 | - `lsp-enable-text-document-color` - Enable `textDocument/documentColor` when server supports it.
35 | - `lsp-headerline-breadcrumb-enable` - Enable `lsp-headerline-breadcrumb-mode`.
36 |
37 |
--------------------------------------------------------------------------------
/docs/tutorials/how-to-turn-off.md:
--------------------------------------------------------------------------------
1 | ---
2 | disqus: emacs-lsp
3 | ---
4 |
5 | # A guide on disabling/enabling lsp-mode features
6 |
7 | Early in the project, we decided to auto-configure/enable all of the stable
8 | features by default in order to improve discoverability and simplify the setup
9 | for the beginners. This decision was considered good by the majority of the
10 | users coming from IDEs but still in `Emacs` community there are a lot of people
11 | looking for a minimal distraction-free experience especially traditional long
12 | time users. Although the turn off `defcustom` settings are documented in
13 | corresponding `README` and available via `customize-group` it turned out that it
14 | is not very easy to find them when you want to turn a particular feature off
15 | which led to a lot of frustration. Hopefully, this article will help solving
16 | that issue:
17 |
18 | 
19 | 1. Symbol highlighting
20 | ``` elisp
21 | (setq lsp-enable-symbol-highlighting nil)
22 | ```
23 | 2. `lsp-ui-doc` - on hover dialogs.
24 | * disable via
25 | ```
26 | (setq lsp-ui-doc-enable nil)
27 | ```
28 | * disable cursor hover (keep mouse hover)
29 | ``` elisp
30 | (setq lsp-ui-doc-show-with-cursor nil)
31 | ```
32 | * disable mouse hover (keep cursor hover)
33 | ``` elisp
34 | (setq lsp-ui-doc-show-with-mouse nil)
35 | ```
36 | 3. Lenses
37 | ``` elisp
38 | (setq lsp-lens-enable nil)
39 | ```
40 | 4. Headerline
41 | ``` elisp
42 | (setq lsp-headerline-breadcrumb-enable nil)
43 | ```
44 | 5. Sideline code actions
45 | * disable whole sideline via
46 | ``` elisp
47 | (setq lsp-ui-sideline-enable nil)
48 | ```
49 | * hide code actions
50 | ``` elisp
51 | (setq lsp-ui-sideline-show-code-actions nil)
52 | ```
53 | 6. Sideline hover symbols
54 | * disable whole sideline via
55 | ``` elisp
56 | (setq lsp-ui-sideline-enable nil)
57 | ```
58 | * hide only hover symbols
59 | ``` elisp
60 | (setq lsp-ui-sideline-show-hover nil)
61 | ```
62 | 7. Modeline code actions
63 | ``` elisp
64 | (setq lsp-modeline-code-actions-enable nil)
65 | ```
66 | 
67 | 8. `Flycheck` (or `flymake` if no `flycheck` is present)
68 | ``` elisp
69 | (setq lsp-diagnostics-provider :none)
70 | ```
71 | 9. Sideline diagnostics
72 | * disable whole sideline via
73 | ``` elisp
74 | (setq lsp-ui-sideline-enable nil)
75 | ```
76 | * hide only errors
77 | ``` elisp
78 | (setq lsp-ui-sideline-show-diagnostics nil)
79 | ```
80 | 10. Eldoc
81 | ``` elisp
82 | (setq lsp-eldoc-enable-hover nil)
83 | ```
84 | 11. Modeline diagnostics statistics
85 | ``` elisp
86 | (setq lsp-modeline-diagnostics-enable nil)
87 | ```
88 | 
89 | 12. Signature help
90 | ``` elisp
91 | (setq lsp-signature-auto-activate nil) ;; you could manually requiest them via `lsp-signature-activate`
92 | ```
93 | 13. Signature help documentation (keep the signatures)
94 | ``` elisp
95 | (setq lsp-signature-render-documentation nil)
96 | ```
97 | 
98 | 14. Completion (`company-mode`)
99 | ``` elisp
100 | (setq lsp-completion-provider :none)
101 | ```
102 | 15. Completion item detail
103 | ``` elisp
104 | (setq lsp-completion-show-detail nil)
105 | ```
106 | 16. Completion item kind
107 | ``` elisp
108 | (setq lsp-completion-show-kind nil)
109 | ```
110 |
--------------------------------------------------------------------------------
/clients/lsp-vimscript.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-vimscript.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, vim, vimscript
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the VimScript Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-vim nil
30 | "LSP support for viml using vim-language-server."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/iamcco/vim-language-server"))
33 |
34 | (defcustom lsp-clients-vim-executable '("vim-language-server" "--stdio")
35 | "Command to start the vim language server."
36 | :group 'lsp-vim
37 | :risky t
38 | :type 'file)
39 |
40 | (defcustom lsp-clients-vim-initialization-options '((iskeyword . "vim iskeyword option")
41 | (vimruntime . "/usr/bin/vim")
42 | (runtimepath . "/usr/bin/vim")
43 | (diagnostic . ((enable . t)))
44 | (indexes . ((runtimepath . t)
45 | (gap . 100)
46 | (count . 3)))
47 | (suggest . ((fromVimruntime . t)
48 | (fromRuntimepath . :json-false))))
49 | "Initialization options for vim language server."
50 | :group 'lsp-vim
51 | :type 'alist)
52 |
53 | (lsp-dependency 'vim-language-server
54 | '(:system "vim-language-server")
55 | '(:npm :package "vim-language-server"
56 | :path "vim-language-server"))
57 |
58 | (lsp-register-client
59 | (make-lsp-client :new-connection (lsp-stdio-connection
60 | (lambda ()
61 | `(,(or (executable-find (cl-first lsp-clients-vim-executable))
62 | (lsp-package-path 'vim-language-server))
63 | ,@(cl-rest lsp-clients-vim-executable))))
64 | :major-modes '(vimrc-mode)
65 | :priority -1
66 | :server-id 'vimls
67 | :initialization-options (lambda () lsp-clients-vim-initialization-options)
68 | :download-server-fn (lambda (_client callback error-callback _update?)
69 | (lsp-package-ensure 'vim-language-server
70 | callback error-callback))))
71 |
72 | (provide 'lsp-vimscript)
73 | ;;; lsp-vimscript.el ends here
74 |
--------------------------------------------------------------------------------
/test/lsp-completion-test.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-completion-test.el --- lsp-completion tests -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 Ivan Yonchovski
4 |
5 | ;; Author: Ivan Yonchovski
6 | ;; Keywords:
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;;
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-completion)
28 | (require 'ert)
29 |
30 | (ert-deftest lsp-completion-test-candidate-kind ()
31 | (should (eq (lsp-completion--candidate-kind
32 | (propertize " " 'lsp-completion-item
33 | (lsp-make-completion-item :kind 3)))
34 | 'function)))
35 |
36 | (ert-deftest lsp-completion-test-fuz-score ()
37 | (cl-labels ((do-test (query cands expected)
38 | (should (equal
39 | (sort cands
40 | (lambda (l r) (> (lsp-completion--fuz-score query l)
41 | (lsp-completion--fuz-score query r))))
42 | expected))))
43 | (do-test "as"
44 | '("hashCode() : int"
45 | "asSubclass(Class clazz) : Class extends U>")
46 | '("asSubclass(Class clazz) : Class extends U>"
47 | "hashCode() : int"))
48 | (do-test "as"
49 | '("hash-map"
50 | "as-definition"
51 | "as-def"
52 | "As-selection"
53 | "To-as-expected"
54 | "amused"
55 | "subclass-1"
56 | "superand-sort")
57 | '("as-definition" ; Prefix match
58 | "as-def" ; Also prefix match (stable)
59 | "As-selection" ; case mismatch, rank lower to near next rank
60 | "hash-map" ; middle match
61 | "amused" ; partial match with prefix match
62 | "To-as-expected" ; more in middle match
63 | "subclass-1" ; more in middle match
64 | "superand-sort" ; partial match without prefix match
65 | ))
66 | (do-test "f"
67 | '("f" "foo" "Foo" "aFoo" "afoo")
68 | '("f" "foo" "Foo" "afoo" "aFoo"))
69 | (do-test "foo"
70 | '("foo" "afoo" "aafoo" "aaafoo" "Foo" "aFoo" "aaFoo" "aaaFoo")
71 | '("foo" "Foo" "afoo" "aFoo" "aafoo" "aaFoo" "aaafoo" "aaaFoo"))
72 | (do-test "F"
73 | '("F" "foo" "Foo" "aFoo" "afoo")
74 | '("F" "Foo" "foo" "aFoo" "afoo"))
75 | (do-test "Fo"
76 | '("Fo" "daFo" "safo")
77 | '("Fo" "daFo" "safo"))
78 | (do-test "F"
79 | '("F" "daFo" "safo")
80 | '("F" "daFo" "safo"))))
81 |
82 | (provide 'lsp-completion-test)
83 | ;;; lsp-completion-test.el ends here
84 |
--------------------------------------------------------------------------------
/scripts/lsp-generate-bindings.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-generate-bindings.el --- Generates lsp-mode bindings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 Ivan Yonchovski
4 |
5 | ;; Author: Ivan Yonchovski
6 | ;; Keywords: convenience
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; script for generating elisp bindings from json schema.
24 |
25 | ;;; Code:
26 |
27 | (with-temp-buffer
28 | (insert-file-contents-literally "generated.protocol.schema.json")
29 |
30 | (-let* ((json-object-type 'plist)
31 | ((&plist :$defs defs :properties) (json-read-from-string (buffer-string))))
32 | `(progn
33 | ,@(->> (append defs properties)
34 | (-partition 2)
35 | (-filter (-lambda ((_ (&plist :type :enum)))
36 | (and (not (string= type "object"))
37 | enum)))
38 | (-keep (-lambda ((type (&plist :enum)))
39 | (cons
40 | (list
41 | 'defvar (intern (format "lsp/%s-lookup"
42 | (s-dashed-words (substring (symbol-name type) 1))))
43 | (if (eq type :TextDocumentSyncKind)
44 | (apply 'vector (-map #'intern enum))
45 | (apply 'vector nil (-map #'intern enum))))
46 | (seq-map-indexed (-lambda (value index)
47 | (list 'defconst (intern (format "lsp/%s-%s"
48 | (s-dashed-words (substring (symbol-name type) 1))
49 | (s-dashed-words value)))
50 | (if (eq type :TextDocumentSyncKind)
51 | index
52 | (1+ index))))
53 | enum))))
54 | (apply #'nconc))
55 |
56 | ,(->> (append defs properties)
57 | (-partition 2)
58 | (-filter (-lambda ((_ (&plist :type)))
59 | (string= type "object")))
60 | (-map (-lambda ((name type-data))
61 | (let* ((key (intern (substring (symbol-name name) 1)))
62 | (required (-map (lambda (field-name)
63 | (intern (concat ":" field-name))) (plist-get type-data :required)))
64 | (params (->> (plist-get type-data :properties)
65 | (-partition 2)
66 | (-map #'cl-first)
67 | (-filter (-not (-partial #'-contains? required))))))
68 | (list key required params))))
69 |
70 | (cl-list* 'lsp-interface)))))
71 |
72 |
73 | (provide 'lsp-generate-bindings)
74 | ;;; lsp-generate-bindings.el ends here
75 |
--------------------------------------------------------------------------------
/scripts/lsp-generate-settings.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-generate-settings.el --- Functions for generating settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Ivan Yonchovski
4 |
5 | ;; Author: Ivan Yonchovski
6 | ;; Keywords:
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; Functions for generating settings from package.json file
24 |
25 | ;; Usage
26 | ;; (lsp-generate-settings "/home/kyoncho/Sources/vscode-java/package.json")
27 |
28 | ;;; Code:
29 |
30 | (require 'cl-lib)
31 | (require 'dash)
32 | (require 'json)
33 | (require 's)
34 |
35 | (defun lsp--convert-type (type enum)
36 | "Convert vscode manifest TYPE to the elisp equivalent.
37 | ENUM is the value of enum key in vscode manifest."
38 | (cond
39 | ((and enum (not (or (equal "boolean" type)
40 | (equal '("boolean") type)))) `(choice (:tag ,@(append enum nil))))
41 | (t (pcase type
42 | ("boolean" 'boolean)
43 | ('("boolean") 'boolean)
44 | ("string" 'string)
45 | ("number" 'number)
46 | ("integer" 'number)
47 | ("array" 'lsp-string-vector)
48 | (`(,type . ,_rest) `(repeat ,(lsp--convert-type type nil)))))))
49 |
50 | (defun lsp-generate-settings (file-name)
51 | "Generate settings for SERVER.
52 | FILE-NAME is path to package.json vscode manifest."
53 | (let* ((json-array-type 'list)
54 | (parsed (json-read-file file-name))
55 | (properties (->> parsed
56 | (assoc 'contributes)
57 | cl-rest
58 | (assoc 'configuration)
59 | cl-rest
60 | (assoc 'properties)
61 | cl-rest))
62 | props-to-register)
63 | (append
64 | (-keep (-lambda ((prop-name . (&alist 'type 'default 'enum 'description 'markdownDescription)))
65 | (let ((type (lsp--convert-type type enum))
66 | (prop-symbol (intern (format "lsp-%s" (s-dashed-words (symbol-name prop-name)))) ))
67 | (unless (boundp prop-symbol)
68 | (push (append (list (symbol-name prop-name) prop-symbol) (when (equal type 'boolean) (list t)))
69 | props-to-register)
70 | `(defcustom ,prop-symbol
71 | ,(cond
72 | ((equal default :json-false) nil)
73 | ((and default (listp default)) (apply 'vector default))
74 | (t default))
75 | ,(or description markdownDescription)
76 | :type ',type
77 | :package-version '(lsp-mode . "7.1.0"))))
78 | )
79 | properties)
80 | `((lsp-register-custom-settings ',props-to-register)))))
81 |
82 | (provide 'lsp-generate-settings)
83 |
84 | ;;; lsp-generate-settings.el ends here
85 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at vibhavp@gmail.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/clients/lsp-perl.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-perl.el --- lsp-perl config -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 lsp-mode developers
4 |
5 | ;; Author: Hiroki Noda
6 | ;; Keywords:
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; lsp-perl client
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-perl nil
30 | "LSP support for Perl"
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/richterger/Perl-LanguageServer")
33 | :package-version '(lsp-mode . "6.3"))
34 |
35 | (defcustom lsp-perl-language-server-path "perl"
36 | "Path to perl interpreter."
37 | :type 'string
38 | :group 'lsp-perl
39 | :package-version '(lsp-mode . "6.3"))
40 |
41 | (defcustom lsp-perl-language-server-port 13603
42 | "Choose listen port."
43 | :type 'integer
44 | :group 'lsp-perl
45 | :package-version '(lsp-mode . "6.3"))
46 |
47 | (defcustom lsp-perl-language-server-client-version "2.1.0"
48 | "Choose client version."
49 | :type 'string
50 | :group 'lsp-perl
51 | :package-version '(lsp-mode . "6.3"))
52 |
53 | (defcustom lsp-perl-perl-cmd nil
54 | "Path to perl interpreter used in Perl Language Server. Defaults to `perl' if nil."
55 | :type 'string
56 | :group 'lsp-perl
57 | :package-version '(lsp-mode . "7.0.1"))
58 | (defcustom lsp-perl-perl-inc nil
59 | "A vector of paths to add to perl library path."
60 | :type 'lsp-string-vector
61 | :group 'lsp-perl
62 | :package-version '(lsp-mode . "7.0.1"))
63 | (defcustom lsp-perl-file-filter nil
64 | "A vector of directories filtering perl file. Defaults to `[\".pm\" \".pl\"]' if nil."
65 | :type 'lsp-string-vector
66 | :group 'lsp-perl
67 | :package-version '(lsp-mode . "7.0.1"))
68 | (defcustom lsp-perl-ignore-dirs nil
69 | "A vector of directories to ignore. Defaults to `[\".vscode\" \".git\" \".svn\"]' if nil."
70 | :type 'lsp-string-vector
71 | :group 'lsp-perl
72 | :package-version '(lsp-mode . "7.0.1"))
73 |
74 | (lsp-register-custom-settings
75 | '(("perl.perlCmd" lsp-perl-perl-cmd)
76 | ("perl.perlInc" lsp-perl-perl-inc)
77 | ("perl.fileFilter" lsp-perl-file-filter)
78 | ("perl.ignoreDirs" lsp-perl-ignore-dirs)))
79 |
80 | (lsp-register-client
81 | (make-lsp-client :new-connection (lsp-stdio-connection
82 | (lambda ()
83 | (list lsp-perl-language-server-path
84 | "-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run" "--"
85 | (format "--port %d --version %s"
86 | lsp-perl-language-server-port lsp-perl-language-server-client-version))))
87 | :major-modes '(perl-mode cperl-mode)
88 | :initialized-fn (lambda (workspace)
89 | (with-lsp-workspace workspace
90 | (lsp--set-configuration
91 | (lsp-configuration-section "perl"))))
92 | :priority -1
93 | :server-id 'perl-language-server))
94 |
95 | (provide 'lsp-perl)
96 | ;;; lsp-perl.el ends here
97 |
98 |
--------------------------------------------------------------------------------
/lsp-icons.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-icons.el --- LSP icons management -*- lexical-binding: t; -*-
2 | ;;
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 | ;;
5 | ;; This program is free software; you can redistribute it and/or modify
6 | ;; it under the terms of the GNU General Public License as published by
7 | ;; the Free Software Foundation, either version 3 of the License, or
8 | ;; (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program. If not, see .
17 | ;;
18 | ;;; Commentary:
19 | ;;
20 | ;; LSP icons management
21 | ;;
22 | ;;; Code:
23 |
24 | (defgroup lsp-icons nil
25 | "LSP icons"
26 | :group 'lsp-mode
27 | :tag "Icons")
28 |
29 | (defcustom lsp-headerline-breadcrumb-icons-enable t
30 | "If non-nil, icons support is enabled for headerline-breadcrumb."
31 | :type 'boolean
32 | :group 'lsp-icons)
33 |
34 | (declare-function all-the-icons-material "ext:all-the-icons" t t)
35 | (declare-function lsp-treemacs-symbol-icon "ext:lsp-treemacs" (kind))
36 | (declare-function lsp-treemacs-get-icon "ext:lsp-treemacs" (icon-name))
37 |
38 | (defun lsp-icons--enabled-for-feature (feature)
39 | "Check if icons support is enabled for FEATURE."
40 | (cond
41 | ((eq feature 'headerline-breadcrumb) lsp-headerline-breadcrumb-icons-enable)
42 | (t t)))
43 |
44 | (defun lsp-icons--fix-image-background (image)
45 | "Fix IMAGE background if it is a file otherwise return as an icon."
46 | (if image
47 | (let ((display-image (get-text-property 0 'display image)))
48 | (if (and (listp display-image)
49 | (plist-member (cl-copy-list (cl-rest display-image)) :type))
50 | (propertize " " 'display
51 | (cl-list* 'image
52 | (plist-put
53 | (cl-copy-list
54 | (cl-rest display-image))
55 | :background (face-attribute 'header-line :background nil t))))
56 | (if (stringp display-image)
57 | (replace-regexp-in-string "\s\\|\t" "" display-image)
58 | (replace-regexp-in-string "\s\\|\t" "" image))))
59 | ""))
60 |
61 | (defun lsp-icons-get-by-file-ext (file-ext &optional feature)
62 | "Get an icon by file FILE-EXT.
63 | FEATURE is the feature that will use the icon which we should check
64 | if its enabled."
65 | (when (and file-ext
66 | (lsp-icons--enabled-for-feature feature)
67 | (functionp 'lsp-treemacs-get-icon))
68 | (lsp-icons--fix-image-background
69 | (lsp-treemacs-get-icon file-ext))))
70 |
71 | (defun lsp-icons-get-by-symbol-kind (kind &optional feature)
72 | "Get an icon by symbol KIND.
73 | FEATURE is the feature that will use the icon which we should check
74 | if its enabled."
75 | (when (and kind
76 | (lsp-icons--enabled-for-feature feature)
77 | (functionp 'lsp-treemacs-symbol-icon))
78 | (lsp-icons--fix-image-background
79 | (lsp-treemacs-symbol-icon kind))))
80 |
81 | (defun lsp-icons-all-the-icons-material-icon (icon-name face fallback &optional feature)
82 | "Get a material icon from all-the-icons by ICON-NAME using FACE.
83 | Fallback to FALLBACK string if not found or not available.
84 | FEATURE is the feature that will use the icon which we should check
85 | if its enabled."
86 | (if (and (functionp 'all-the-icons-material)
87 | (lsp-icons--enabled-for-feature feature))
88 | (all-the-icons-material icon-name
89 | :face face)
90 | (propertize fallback 'face face)))
91 |
92 | (provide 'lsp-icons)
93 | ;;; lsp-icons.el ends here
94 |
--------------------------------------------------------------------------------
/clients/lsp-elm.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-elm.el --- Elm Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Daniel V
4 |
5 | ;; Author: Daniel V
6 | ;; Keywords: elm lsp
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; lsp-elm client
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-elm nil
30 | "LSP support for the Elm programming language, using the server from https://github.com/elm-tooling/elm-language-server"
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/elm-tooling/elm-language-server"))
33 |
34 | (defcustom lsp-elm-elm-language-server-path nil
35 | "Path for elm-language-server.
36 | Can be installed globally with: npm i -g @elm-tooling/elm-language-server,
37 | or manually by cloning the repo and following the installing instructions."
38 | :group 'lsp-elm
39 | :risky t
40 | :type 'file)
41 |
42 | (defcustom lsp-elm-trace-server
43 | nil
44 | "Enable/disable trace logging of client and server communication."
45 | :type 'boolean
46 | :group 'lsp-elm)
47 |
48 | (defcustom lsp-elm-elm-path
49 | ""
50 | "The path to your elm executable. Should be empty by default, in that case it will assume the name and try to first get it from a local npm installation or a global one. If you set it manually it will not try to load from the npm folder."
51 | :type 'file
52 | :group 'lsp-elm)
53 |
54 | (defcustom lsp-elm-elm-format-path
55 | ""
56 | "The path to your elm-format executable. Should be empty by default, in that case it will assume the name and try to first get it from a local npm installation or a global one. If you set it manually it will not try to load from the npm folder."
57 | :type 'file
58 | :group 'lsp-elm)
59 |
60 | (defcustom lsp-elm-elm-test-path
61 | ""
62 | "The path to your elm-test executable. Should be empty by default, in that case it will assume the name and try to first get it from a local npm installation or a global one. If you set it manually it will not try to load from the npm folder."
63 | :type 'file
64 | :group 'lsp-elm)
65 |
66 | (defcustom lsp-elm-elm-analyse-trigger
67 | "change"
68 | "Elm-analyse executed on 'change', 'save' or 'never' (default: 'change')."
69 | :type '(choice (const "change")
70 | (const "save")
71 | (const "never"))
72 | :group 'lsp-elm)
73 |
74 | (defcustom lsp-elm-server-args
75 | '("--stdio")
76 | "Arguments to pass to the server."
77 | :type '(repeat string)
78 | :group 'lsp-elm)
79 |
80 | (defun lsp-elm--elm-language-server-command ()
81 | "Generate LSP startup command for the Elm Language Server."
82 | (cons
83 | (or lsp-elm-elm-language-server-path
84 | (lsp-package-path 'elm-language-server))
85 | lsp-elm-server-args))
86 |
87 | (defun lsp-clients-elm--make-init-options ()
88 | "Init options for elm-language-server."
89 | `(:elmPath ,lsp-elm-elm-path
90 | :elmFormatPath ,lsp-elm-elm-format-path
91 | :elmTestPath ,lsp-elm-elm-test-path
92 | :elmAnalyseTrigger ,lsp-elm-elm-analyse-trigger
93 | :trace.server ,(lsp-json-bool lsp-elm-trace-server)))
94 |
95 | (lsp-dependency 'elm-language-server
96 | '(:system "elm-language-server")
97 | '(:npm :package "@elm-tooling/elm-language-server"
98 | :path "elm-language-server"))
99 |
100 | (lsp-register-client
101 | (make-lsp-client
102 | :new-connection (lsp-stdio-connection #'lsp-elm--elm-language-server-command)
103 | :major-modes '(elm-mode)
104 | :priority -1
105 | :initialization-options #'lsp-clients-elm--make-init-options
106 | :server-id 'elm-ls
107 | :download-server-fn (lambda (_client callback error-callback _update?)
108 | (lsp-package-ensure 'elm-language-server callback error-callback))))
109 |
110 | (provide 'lsp-elm)
111 | ;;; lsp-elm.el ends here
112 |
--------------------------------------------------------------------------------
/refcard/lsp-refcard.tex:
--------------------------------------------------------------------------------
1 | \documentclass[a4paper,10pt]{article}
2 | \usepackage[margin=1cm]{geometry}
3 | \pagestyle{empty}
4 |
5 | \usepackage{textcomp}
6 | \usepackage{multicol}
7 | \usepackage{menukeys}
8 | \usepackage{enumitem}
9 | \usepackage{xcolor}
10 | \usepackage{xpatch}
11 | \usepackage{xparse}
12 | \usepackage{calc}
13 | \usepackage{tcolorbox}
14 |
15 | \colorlet{faded}{lightgray}
16 | \colorlet{namespace}{black}
17 | \def\alternateitem\item[#1]{\item[#1]\color{faded}}
18 | \NewDocumentCommand\ns{g}{\IfValueTF{#1}{\gdef\currentnamespace{#1}\currentnamespace}{\textcolor{namespace}{\currentnamespace}}}
19 | \renewcommand\section[1]{\bigskip\par\textbf{\large#1}\medskip}
20 | \renewcommand\subsection[1]{\medskip\par\textbf{#1}\medskip}
21 | \newcommand\meta[1]{\textlangle\textit{#1}\textrangle}
22 | \newcommand\keyify[1]{\keys{\ttfamily#1}}
23 | \newlist{keylist}{description}{1}
24 | \setlist[keylist]{
25 | labelindent = 2ex,
26 | itemsep = -1ex,
27 | font = \keyify,
28 | before = \let\&\alternateitem
29 | \xpretocmd{\item}{\color{black}}{}{}
30 | \ttfamily
31 | }
32 |
33 | \setlength\parindent{0em}
34 | \setlength\parsep{0ex}
35 | \renewcommand\baselinestretch{1.2}
36 | \newcommand{\prefix}{\meta{s-l}}
37 |
38 | \begin{document}
39 | \begin{center}
40 | \Huge
41 | lsp-mode Quick-Reference Card
42 | \par\bigskip
43 | \end{center}
44 |
45 | \begin{center}
46 | \begin{tcolorbox}[title=Getting Help for lsp-mode , center title, fonttitle=\Large\bfseries]
47 | \begin{keylist}[labelindent=4ex,before=,labelwidth=\widthof{\keyify{\meta{prefix}
48 | C-h}}]
49 | \item[\prefix] All lsp commands start by using the prefix command.
50 |
51 | \end{keylist}
52 | \end{tcolorbox}
53 | \end{center}
54 | \bigskip
55 |
56 | \setlength{\columnsep}{1cm}
57 |
58 | \begin{multicols}{2}
59 |
60 | \section{Programming}
61 | \subsection{Change Server State}
62 |
63 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c C-c}}]
64 | \item[\prefix s s] Start server
65 | \item[\prefix s r] Restart server
66 | \item[\prefix s q] Shutdown server
67 | \item[\prefix s d] Describe session
68 | \item[\prefix s D] Disconnect buffer from LS
69 | \end{keylist}
70 |
71 | \subsection{Toggle Actions}
72 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c RET}}]
73 | \item[\prefix T l] Toggle lenses
74 | \item[\prefix T L] Toggle log I/O
75 | \item[\prefix T h] Toggle symbol highlighting
76 | \item[\prefix T S] \color{red}{Toggle Sideline}
77 | \item[\prefix T d] \color{red}{Toggle Documentation Popup}
78 | \item[\prefix T s] Toggle signature
79 | \item[\prefix T f] Toggle on Type Formatting
80 | \end{keylist}
81 |
82 | \subsection{GoTo}
83 | \begin{keylist}[labelwidth=\widthof{\keyify{s-l r r}}]
84 | \item[\prefix g g] Find Definitions
85 | \item[\prefix g r] Find References
86 | \item[\prefix g i] Find Implementations
87 | \item[\prefix g t] Find Type Definition
88 | \item[\prefix g d] Find Declarations
89 | \item[\prefix g h] \color{blue}{Show Call Hierarchy}
90 | \item[\prefix g e] \color{blue}{Treemacs Error List}
91 | \item[\prefix g a] Find Symbol in Workspace
92 | \end{keylist}
93 |
94 | \subsection{Workspace}
95 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c M-.}}]
96 | \item[\prefix F a] Add folder to workspace
97 | \item[\prefix F r] Remove folder from workspaces
98 | \item[\prefix F b] Remove folder from the workspace blacklist
99 | \end{keylist}
100 |
101 | \columnbreak
102 |
103 | \subsection{Peek}
104 | \begin{keylist}[labelwidth=\widthof{\keyify{s-l G s}}]
105 | \item[\prefix G g] \color{red}{Peek Definitions}
106 | \item[\prefix G r] \color{red}{Peek References}
107 | \item[\prefix G i] \color{red}{Peek Implementations}
108 | \item[\prefix G s] \color{red}{Peek Workspace Symbols}
109 | \end{keylist}
110 |
111 | \subsection{Find Actions}
112 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c C-d C-a}}]
113 | \item[\prefix h h] Describe Symbol at Point
114 | \item[\prefix h s] Signature Help
115 | \item[\prefix h g] \color{red}{lsp-ui-doc-glance}
116 | \end{keylist}
117 |
118 | \subsection{Refactor}
119 | \begin{keylist}[labelwidth=\widthof{\keyify{s-l r r}}]
120 | \item[\prefix r r] Rename
121 | \item[\prefix r o] Organize Imports
122 | \end{keylist}
123 |
124 | \subsection{Code Actions}
125 | \begin{keylist}[labelwidth=\widthof{\keyify{s-l r r}}]
126 | \item[\prefix a a] Code actions
127 | \item[\prefix a h] Highlight Symbol
128 | \end{keylist}
129 |
130 | \end{multicols}
131 | \end{document}
132 |
--------------------------------------------------------------------------------
/docs/page/main-features.md:
--------------------------------------------------------------------------------
1 | # Main features
2 |
3 | ## Completion at point
4 |
5 | If LSP server supports completion, `lsp-mode` use symbols returned by the server to present the user when completion is triggered via `completion-at-point`.
6 |
7 | For better performance and results, use `company-capf` by installing [company-mode](https://company-mode.github.io/).
8 |
9 | 
10 |
11 | You can check above the recommended settings for `company-mode`:
12 |
13 | ```elisp
14 | (setq company-minimum-prefix-length 1
15 | company-idle-delay 0.0) ;; default is 0.2
16 | ```
17 |
18 | ## Code navigation
19 |
20 | `lsp-find-definition`
21 |
22 | 
23 |
24 | `lsp-find-references`
25 |
26 | 
27 |
28 | ## Code lens
29 |
30 | In case the LSP server supports code lens:
31 |
32 | 
33 |
34 | ## Project errors on modeline
35 |
36 | To see all error statistics in the modeline you can enable `lsp-modeline-diagnostics-mode` or `(setq lsp-modeline-diagnostics-enable t)`. This is especially useful for languages that compilation might be broken due to errors in other files(e.g. Java/Haskell).
37 |
38 | 
39 |
40 | ```elisp
41 | (with-eval-after-load 'lsp-mode
42 | ;; :global/:workspace/:file
43 | (setq lsp-modeline-diagnostics-scope :workspace))
44 | ```
45 |
46 | _Tip:_ To find out the global errors you might use `lsp-treemacs-errors-list`.
47 |
48 | ## Code actions on modeline
49 |
50 | For a UI feedback of the available code actions, you can enable `lsp-modeline-code-actions-mode` which shows available code actions on modeline:
51 |
52 | With `lsp-modeline-code-actions-segments` you can customize what to show on the modeline as you want:
53 |
54 | |`lsp-modeline-code-actions-segments`|result|
55 | |:-----:|:------:|
56 | |`'(count icon)` (Default)||
57 | |`'(name icon)`||
58 | |`'(icon)`||
59 | |`'(count icon name)`||
60 |
61 | ## Breadcrumb on headerline
62 |
63 | For a UI feedback on headerline of the document symbols at point, current file or project name, you can enable `lsp-headerline-breadcrumb-mode` which shows a breadcrumb on top of window.
64 |
65 | You can customize the breadcrumb segments via `lsp-headerline-breadcrumb-segments` variable, some examples:
66 |
67 | |`lsp-headerline-breadcrumb-segments`|result|
68 | |:-----:|:------:|
69 | |`'(path-up-to-project file symbols)` (Default)||
70 | |`'(project file symbols)`||
71 | |`'(symbols)`||
72 |
73 | If `lsp-headerline-breadcrumb-segments` contains `'symbols`, you can optionally label the corresponding entries in the headerline display by setting `lsp-headerline-breadcrumb-enable-symbol-numbers` to `t`.
74 |
75 | ## Symbol highlights
76 |
77 | In case LSP server supports `hover` feature:
78 |
79 | 
80 |
81 | ## Formatting
82 |
83 | 
84 |
85 | In general the formatter settings are language server specific(e. g. `JDT LS` uses eclipse formatter file and `lsp-java-format-settings-url` to configure it while clangd uses `clangd-format` and `lsp-dart` uses the built-in `dartfmt` from `Dart SDK`). The only settings that are controlled on `lsp-mode` level are indent size and whether the server should use tabs or spaces.
86 |
87 | - Use `c-basic-offset` for `cc-mode` derived moves(e. g. java, C++) to control the tab size.
88 | - Use `tab-width` for any other mode to do the same.
89 | - Use `indent-tabs-mode` for selecting tab/spaces.
90 |
91 | ## Debugger
92 |
93 | `lsp-mode` integrates with [dap-mode](https://emacs-lsp.github.io/dap-mode/) with implements the DAP(Debugger Adapter Protocol), for more information check the [`dap-mode` documentation](https://emacs-lsp.github.io/dap-mode/).
94 |
95 | 
96 |
97 | ## Integrations
98 |
99 | `lsp-mode` supports many integrations for improve the user experience like [treemacs](https://github.com/emacs-lsp/lsp-treemacs), [Helm](https://github.com/emacs-lsp/helm-lsp), [Ivy](https://github.com/emacs-lsp/lsp-ivy) and others.
100 |
101 | For all available integrations, check the `Extensions` section on the left navigation.
102 |
--------------------------------------------------------------------------------
/docs/page/performance.md:
--------------------------------------------------------------------------------
1 | Performance
2 | ===========
3 |
4 | ## Tuning
5 |
6 | Use `M-x lsp-doctor` to validate if your `lsp-mode` is properly configured. In the section below, you could find description for each of the checks:
7 |
8 | When configured properly `lsp-mode`'s performance is on par with mainstream LSP clients (e. g. `VScode`, `Theia`, etc). Here are steps to achieve optimal results.
9 |
10 | - Use Emacs 27+ with native json support. (Note: this requires that you have [libjansson](http://www.digip.org/jansson/) installed, and that emacs was compiled with \`–with-json\` passed to \`./configure\`.) You can check your installation for native json support by running M-: `(functionp 'json-serialize)` RET.
11 | Benchmarks show that Emacs 27 is `~15 times` faster than Emacs when using Elisp json parser implementation.
12 |
13 | - Adjust `gc-cons-threshold`. The default setting is too low for `lsp-mode`'s needs due to the fact that client/server communication generates a lot of memory/garbage. You have two options:
14 |
15 | - Set it to big number(100mb) like most of the popular starter kits like Spacemacs/Doom/Prelude, etc do:
16 |
17 | ```elisp
18 | (setq gc-cons-threshold 100000000)
19 | ```
20 |
21 | - Follow the method recommended by Gnu Emacs Maintainer Eli Zaretskii: "My suggestion is to repeatedly multiply gc-cons-threshold by 2 until you stop seeing significant improvements in responsiveness, and in any case not to increase by a factor larger than 100 or somesuch. If even a 100-fold increase doesn't help, there's some deeper problem with the Lisp code which produces so much garbage, or maybe GC is not the reason for slowdown." Source:
22 |
23 | - Increase the amount of data which Emacs reads from the process. Again the emacs default is too low 4k considering that the some of the language server responses are in 800k - 3M range.
24 |
25 | ``` elisp
26 | (setq read-process-output-max (* 1024 1024)) ;; 1mb
27 | ```
28 |
29 | - Make sure that you are using `company-capf` as the completion provider with:
30 |
31 | ``` elisp
32 | (setq lsp-completion-provider :capf)
33 | ```
34 |
35 | *Note:* - to verify which `company` backend implementation you are using do `M-x company-diag` when performing auto-completion.
36 |
37 | - Optional: Disable `lsp-ui`. Normally, `lsp-ui` is very fast but in some systems (especially when using `Windows`) `lsp-ui` overlays and popups might slow down emacs.
38 | - Optional: fine-tune `lsp-idle-delay`. This variable determines how often lsp-mode will refresh the highlights, lenses, links, etc while you type.
39 |
40 | ``` elisp
41 | (setq lsp-idle-delay 0.500)
42 | ```
43 | ### gccemacs
44 |
45 | [gccemacs](https://akrl.sdf.org/gccemacs.html) is a bleeding-edge version of `Emacs` that compiles elisp to native code, resulting in more than 200% speedup. For everyone looking for optimal performance, `gccemacs` is the way to go.
46 |
47 | ## Ignore watch folders/files
48 |
49 | If the server supports watch files, by default `lsp-mode` tries to watch all files and folders of the project ignoring the regexp from `lsp-file-watch-ignored`. If you don't want some file or folder
50 | to be watched for performance reasons, you can add a regexp to that variable excluding the file or folder.
51 | Also you can disable the file watch feature with:
52 |
53 | ```elisp
54 | (setq lsp-enable-file-watchers nil)
55 | ```
56 |
57 | ## Check if logging is switched off.
58 |
59 | Make sure `lsp-log-io` is `nil`. You might have forgotten it after a debugging session, for example. It can cause a great performance hit.
60 |
61 | ```elisp
62 | (setq lsp-log-io nil) ; if set to true can cause a performance hit
63 | ```
64 |
65 | Sometimes you might need to check logging for specific LSP server configuration as well, i.e. for `lsp-eslint` it is: `lsp-eslint-trace-server`.
66 |
67 | ## Reporting performance problems
68 |
69 | If you have tried all of the non-optional steps from the list and `emacs` is still not very responsive please open a PR with the following information:
70 |
71 | - Collect **lsp-log** data after setting `lsp-print-performance` to `t`.
72 |
73 | ``` elisp
74 | (setq lsp-print-performance t)
75 | ```
76 |
77 | - Include emacs performance report. Use the following step to collect it:
78 | - `M-x profiler-start` and select `CPU`
79 | - Reproduce the slow behavior.
80 | - `M-x profiler-stop`
81 | - In the profiler report expand all nodes by doing `C-u TAB`.
82 |
83 | *Note:* - `lsp-mode` is just a frontend and the performance depends on server as well. Some servers (e. g. Palantir's Python Language Server) might be slow when performing auto-completion.
84 |
--------------------------------------------------------------------------------
/clients/lsp-kotlin.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-kotlin.el --- description -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2020 emacs-lsp maintainers
4 |
5 | ;; Author: emacs-lsp maintainers
6 | ;; Keywords: lsp, kotlin
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; LSP Clients for the Kotlin Programming Language.
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 |
29 | (defgroup lsp-kotlin nil
30 | "LSP support for Kotlin, using KotlinLanguageServer."
31 | :group 'lsp-mode
32 | :link '(url-link "https://github.com/fwcd/KotlinLanguageServer"))
33 |
34 | (define-obsolete-variable-alias
35 | 'lsp-kotlin-language-server-path
36 | 'lsp-clients-kotlin-server-executable
37 | "lsp-mode 6.4")
38 |
39 | (defcustom lsp-clients-kotlin-server-executable "kotlin-language-server"
40 | "The kotlin-language-server executable to use.
41 | Leave as just the executable name to use the default behavior of finding the
42 | executable with `exec-path'."
43 | :type 'string
44 | :group 'lsp-kotlin)
45 |
46 | (defcustom lsp-kotlin-trace-server "off"
47 | "Traces the communication between VSCode and the Kotlin language server."
48 | :type '(choice (:tag "off" "messages" "verbose"))
49 | :group 'lsp-kotlin
50 | :package-version '(lsp-mode . "6.1"))
51 |
52 | (defcustom lsp-kotlin-compiler-jvm-target "1.8"
53 | "Specifies the JVM target, e.g. \"1.6\" or \"1.8\""
54 | :type 'string
55 | :group 'lsp-kotlin
56 | :package-version '(lsp-mode . "6.1"))
57 |
58 | (defcustom lsp-kotlin-linting-debounce-time 250
59 | "[DEBUG] Specifies the debounce time limit. Lower to increase
60 | responsiveness at the cost of possible stability issues."
61 | :type 'number
62 | :group 'lsp-kotlin
63 | :package-version '(lsp-mode . "6.1"))
64 |
65 | (defcustom lsp-kotlin-completion-snippets-enabled t
66 | "Specifies whether code completion should provide snippets (true) or plain-text items (false)."
67 | :type 'boolean
68 | :group 'lsp-kotlin
69 | :package-version '(lsp-mode . "6.1"))
70 |
71 | (defcustom lsp-kotlin-debug-adapter-enabled t
72 | "[Recommended] Specifies whether the debug adapter should be used. When enabled a debugger for Kotlin will be available."
73 | :type 'boolean)
74 |
75 | (defcustom lsp-kotlin-debug-adapter-path ""
76 | "Optionally a custom path to the debug adapter executable."
77 | :type 'string
78 | :group 'lsp-kotlin
79 | :package-version '(lsp-mode . "6.1"))
80 |
81 | (defcustom lsp-kotlin-external-sources-use-kls-scheme t
82 | "[Recommended] Specifies whether URIs inside JARs should be represented using the 'kls'-scheme."
83 | :type 'boolean
84 | :group 'lsp-kotlin
85 | :package-version '(lsp-mode . "6.1"))
86 |
87 | (defcustom lsp-kotlin-external-sources-auto-convert-to-kotlin t
88 | "Specifies whether decompiled/external classes should be auto-converted to Kotlin."
89 | :type 'boolean
90 | :group 'lsp-kotlin
91 | :package-version '(lsp-mode . "6.1"))
92 |
93 | (lsp-register-custom-settings
94 | '(("kotlin.externalSources.autoConvertToKotlin" lsp-kotlin-external-sources-auto-convert-to-kotlin t)
95 | ("kotlin.externalSources.useKlsScheme" lsp-kotlin-external-sources-use-kls-scheme t)
96 | ("kotlin.debugAdapter.path" lsp-kotlin-debug-adapter-path)
97 | ("kotlin.debugAdapter.enabled" lsp-kotlin-debug-adapter-enabled t)
98 | ("kotlin.completion.snippets.enabled" lsp-kotlin-completion-snippets-enabled t)
99 | ("kotlin.linting.debounceTime" lsp-kotlin-linting-debounce-time)
100 | ("kotlin.compiler.jvm.target" lsp-kotlin-compiler-jvm-target)
101 | ("kotlin.trace.server" lsp-kotlin-trace-server)
102 | ("kotlin.languageServer.path" lsp-clients-kotlin-server-executable)))
103 |
104 | (lsp-register-client
105 | (make-lsp-client
106 | :new-connection (lsp-stdio-connection lsp-clients-kotlin-server-executable)
107 | :major-modes '(kotlin-mode)
108 | :priority -1
109 | :server-id 'kotlin-ls
110 | :initialized-fn (lambda (workspace)
111 | (with-lsp-workspace workspace
112 | (lsp--set-configuration (lsp-configuration-section "kotlin"))))))
113 |
114 | (provide 'lsp-kotlin)
115 | ;;; lsp-kotlin.el ends here
116 |
--------------------------------------------------------------------------------
/test/lsp-javascript-test.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-clients-test.el --- unit tests for lsp-clients.el -*- lexical-binding: t -*-
2 |
3 | ;; Copyright (C) 2019 Daniel Martín .
4 |
5 | ;; This program is free software: you can redistribute it and/or modify
6 | ;; it under the terms of the GNU General Public License as published by
7 | ;; the Free Software Foundation, either version 3 of the License, or
8 | ;; (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program. If not, see .
17 |
18 | ;;; Code:
19 |
20 | (require 'ert)
21 | (require 'lsp-javascript)
22 | (require 'js) ;; Standard mode in Emacs for JS.
23 |
24 | (defconst test-location (file-name-directory (or load-file-name buffer-file-name)))
25 |
26 | ;; Some of the different flavors of the @flow tag we may
27 | ;; encounter, and things we don't want to match.
28 | (defconst lsp-flow-regular-tag "// @flow")
29 | (defconst lsp-flow-c-style-tag "/* @flow */")
30 | (defconst lsp-flow-simple-multiline-tag
31 | "/**
32 | * @flow
33 | */")
34 | (defconst lsp-flow-multiline-with-comments-before-tag
35 | "/**
36 | * This is a wonderful Flow file.
37 | *
38 | * Author: Awesome programmer.
39 | *
40 | * @flow
41 | */")
42 | (defconst lsp-flow-wrong-tag
43 | "/**
44 | * @notflow
45 | */")
46 | (defconst lsp-flow-but-not-in-comment-tag "@flow")
47 |
48 | (ert-deftest lsp-flow-regular-tag-detection ()
49 | (should (with-temp-buffer
50 | (insert lsp-flow-regular-tag)
51 | (lsp-clients-flow-tag-string-present-p))))
52 |
53 | (ert-deftest lsp-flow-c-style-tag-detection ()
54 | (should (with-temp-buffer
55 | (insert lsp-flow-c-style-tag)
56 | (lsp-clients-flow-tag-string-present-p))))
57 |
58 | (ert-deftest lsp-flow-simple-multiline-tag-detection ()
59 | (should (with-temp-buffer
60 | (insert lsp-flow-simple-multiline-tag)
61 | (lsp-clients-flow-tag-string-present-p))))
62 |
63 | (ert-deftest lsp-flow-simple-multiline-with-comments-before-tag-detection ()
64 | (should (with-temp-buffer
65 | (insert lsp-flow-multiline-with-comments-before-tag)
66 | (lsp-clients-flow-tag-string-present-p))))
67 |
68 | (ert-deftest lsp-flow-wrong-tag-detection ()
69 | (should (not (with-temp-buffer
70 | (insert lsp-flow-wrong-tag)
71 | (lsp-clients-flow-tag-string-present-p)))))
72 |
73 | (ert-deftest lsp-flow-but-not-in-comment-tag-detection ()
74 | (should (not (with-temp-buffer
75 | (insert lsp-flow-but-not-in-comment-tag)
76 | (lsp-clients-flow-tag-string-present-p)))))
77 |
78 | (ert-deftest lsp-flow-should-activate-on-flow-project ()
79 | ;; Set `js-mode' ON and check that a Flow project activates the Flow
80 | ;; LSP client.
81 | (let ((major-mode 'js-mode))
82 | (should (lsp-clients-flow-activate-p (concat test-location "fixtures/SampleFlowProject/src/sample.js") nil))))
83 |
84 | (ert-deftest lsp-flow-should-activate-on-flow-project-without-flow-file-comment ()
85 | (let ((major-mode 'js-mode))
86 | (should (lsp-clients-flow-activate-p (concat test-location "fixtures/SampleFlowProject/src/sample-without-flow-comment.js") nil))))
87 |
88 | (ert-deftest lsp-flow-should-not-activate-if-not-flow-project-or-no-tag ()
89 | (let ((major-mode 'js-mode))
90 | (should (not (lsp-clients-flow-activate-p (concat test-location "fixtures/SampleJsProject/src/sample.js") nil)))))
91 |
92 | (ert-deftest lsp-flow-should-not-activate-on-typescript-project ()
93 | ;; Set `js-mode' ON and check that a TypeScript project does not
94 | ;; activate the Flow LSP client.
95 | (let ((major-mode 'js-mode))
96 | (should (not (lsp-clients-flow-activate-p (concat test-location "fixtures/SampleTypeScriptProject/src/sample.ts") nil)))))
97 |
98 | (ert-deftest lsp-typescript-javascript-activates-based-on-file-extension ()
99 | (should (lsp-typescript-javascript-tsx-jsx-activate-p "abc.js"))
100 | (should (lsp-typescript-javascript-tsx-jsx-activate-p "abc.jsx"))
101 | (should (lsp-typescript-javascript-tsx-jsx-activate-p "abc.ts"))
102 | (should (lsp-typescript-javascript-tsx-jsx-activate-p "abc.tsx"))
103 | (should (lsp-typescript-javascript-tsx-jsx-activate-p "a1.ts"))
104 | (should (lsp-typescript-javascript-tsx-jsx-activate-p "a1.d.ts"))
105 | (should (not (lsp-typescript-javascript-tsx-jsx-activate-p "abc.tsxx")))
106 | (should (not (lsp-typescript-javascript-tsx-jsx-activate-p "abc.jss"))))
107 |
108 | ;;; lsp-clients-test.el ends here
109 |
--------------------------------------------------------------------------------
/docs/page/installation.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | You need first `lsp-mode`, that is a Emacs client for an LSP server.
4 | Then you need to install the specific LSP server for your language.
5 |
6 | ## Client
7 |
8 | `lsp-mode` has multiple ways to install it.
9 |
10 | ### Manually via MELPA
11 |
12 | The recommended way to install `lsp-mode` is via `package.el` - the built-in package manager in Emacs. `lsp-mode` is available on the two major `package.el` community maintained repos - [MELPA Stable](http://stable.melpa.org) and [MELPA](http://melpa.org).
13 |
14 | M-x `package-install` RET `lsp-mode` RET
15 |
16 | When updating your packages with `package.el`, we recommend the following procedure:
17 |
18 | 1. Delete your LSP-related packages
19 | 2. Restart Emacs
20 | 3. Install the new versions of the packages.
21 |
22 | ### Doom Emacs
23 |
24 | [Doom Emacs](https://github.com/hlissner/doom-emacs) has a module to install and configure `lsp-mode` automatically, you just need to add `lsp` below `:tools` in your `init.el`.
25 |
26 | To add `lsp-mode` support to some language, you can add the `+lsp` flag to the language you want. Example:
27 |
28 | `init.el`
29 | ```elisp
30 | ...
31 | :lang
32 | (clojure +lsp)
33 | (dart +lsp)
34 | (java +lsp)
35 | ...
36 | ```
37 |
38 | For Doom Emacs module flags and more information, check the [doom-emacs lsp module documentation](https://github.com/hlissner/doom-emacs/tree/develop/modules/tools/lsp).
39 |
40 | ### Spacemacs
41 |
42 | [lsp-mode](https://emacs-lsp.github.io/lsp-mode) is included in spacemacs develop branch. Add `lsp` to `dotspacemacs-configuration-layers` and configure the language that you want to use to be backed by `lsp` backend.
43 |
44 | ### Vanilla Emacs
45 |
46 | You could go minimal and use `lsp-mode` as it is without external packages with the built-in `flymake` and `completion-at-point` or you could install the following extensions for better experience:
47 |
48 | - [lsp-ui](https://emacs-lsp.github.io/lsp-ui/#intro) for fancy sideline, popup documentation, VScode-like peek UI, etc.
49 | - [flycheck](https://github.com/flycheck/flycheck) if you prefer the more popular `flycheck` over renewed `flymake`. `lsp-mode` will automatically pick it up.
50 | - [company-mode](https://github.com/company-mode/company-mode) for completion popups.
51 | - [lsp-treemacs](https://github.com/emacs-lsp/lsp-treemacs) for various tree based UI controls (symbols, errors overview, call hierarchy, etc.)
52 | - [helm-lsp](https://github.com/emacs-lsp/helm-lsp) provides on type completion alternative of `xref-apropos` using `helm`.
53 | - [lsp-ivy](https://github.com/emacs-lsp/lsp-ivy) provides on type completion alternative of `xref-apropos` using `ivy`.
54 | - [dap-mode](https://emacs-lsp.github.io/dap-mode) if your language is supported by the debugger.
55 |
56 | ```elisp
57 | ;; if you want to change prefix for lsp-mode keybindings.
58 | (setq lsp-keymap-prefix "s-l")
59 |
60 | (require 'lsp-mode)
61 | (add-hook 'XXX-mode-hook #'lsp)
62 | ```
63 |
64 | Where `XXX` could be major mode like `python`, `java`, `c++`. Alternatively, if you want to minimize your configuration you may use `prog-mode-hook`. In case you do that, `lsp` will try to start for each programming mode and echo a message when there is no client registered for the current mode or if the corresponding server is not present. In addition, `lsp-mode` will automatically detect and configure [lsp-ui](https://emacs-lsp.github.io/lsp-ui) and [company-mode](https://github.com/company-mode/company-mode). To turn off that behavior you could set `lsp-auto-configure` to `nil`.
65 |
66 | To defer LSP server startup (and DidOpen notifications) until the buffer is visible you can use `lsp-deferred` instead of `lsp`:
67 |
68 | ```elisp
69 | (add-hook 'XXX-mode-hook #'lsp-deferred)
70 | ```
71 |
72 | #### use-package
73 |
74 | Replace `(require 'lsp-mode)` with the following if you use use-package.
75 |
76 | ```elisp
77 | ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
78 | (setq lsp-keymap-prefix "s-l")
79 |
80 | (use-package lsp-mode
81 | :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
82 | (XXX-mode . lsp)
83 | ;; if you want which-key integration
84 | (lsp-mode . lsp-enable-which-key-integration))
85 | :commands lsp)
86 |
87 | ;; optionally
88 | (use-package lsp-ui :commands lsp-ui-mode)
89 | ;; if you are helm user
90 | (use-package helm-lsp :commands helm-lsp-workspace-symbol)
91 | ;; if you are ivy user
92 | (use-package lsp-ivy :commands lsp-ivy-workspace-symbol)
93 | (use-package lsp-treemacs :commands lsp-treemacs-errors-list)
94 |
95 | ;; optionally if you want to use debugger
96 | (use-package dap-mode)
97 | ;; (use-package dap-LANGUAGE) to load the dap adapter for your language
98 |
99 | ;; optional if you want which-key integration
100 | (use-package which-key
101 | :config
102 | (which-key-mode))
103 |
104 | ```
105 |
106 | To defer LSP server startup (and DidOpen notifications) until the buffer is visible you can use `lsp-deferred` instead of `lsp`:
107 |
108 | ```elisp
109 | (use-package lsp-mode
110 | :hook (XXX-mode . lsp-deferred)
111 | :commands (lsp lsp-deferred))
112 | ```
113 |
114 | ## Install a language server
115 |
116 | For instructions on how to install a server for your language, check the [available supported servers](./languages.md).
117 |
--------------------------------------------------------------------------------
/clients/lsp-json.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-json.el --- vscode-json-languageserver integration -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Kien Nguyen
4 |
5 | ;; Author: kien.n.quang at gmail.com
6 | ;; Keywords: lsp
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;;
24 |
25 | ;;; Code:
26 |
27 | (require 'lsp-mode)
28 | (require 'ht)
29 | (require 'url)
30 | (require 'url-util)
31 |
32 | (defgroup lsp-json nil
33 | "LSP support for JSON, using vscode-json-languageserver."
34 | :group 'lsp-mode
35 | :link '(url-link "https://github.com/vscode-langservers/vscode-json-languageserver")
36 | :package-version '(lsp-mode . "6.3"))
37 |
38 | (defcustom lsp-json-schemas nil
39 | "Associate schemas to JSON files in the current project"
40 | :type '(repeat alist)
41 | :group 'lsp-json
42 | :package-version '(lsp-mode . "6.3"))
43 |
44 | (defcustom lsp-http-proxy nil
45 | "The URL of the proxy server to use when fetching schema."
46 | :type 'string
47 | :group 'lsp-json
48 | :package-version '(lsp-mode . "6.3"))
49 |
50 | (defcustom lsp-http-proxyStrictSSL t
51 | "The URL of the proxy server to use when fetching schema."
52 | :type 'boolean
53 | :group 'lsp-json
54 | :package-version '(lsp-mode . "6.3"))
55 |
56 | (lsp-register-custom-settings
57 | '(("json.schemas" lsp-json-schemas)
58 | ("http.proxy" lsp-http-proxy)
59 | ("http.proxyStrictSSL" lsp-http-proxyStrictSSL)))
60 |
61 | (defvar lsp-json--extra-init-params
62 | `(:provideFormatter t
63 | :handledSchemaProtocols ["file" "http" "https"]))
64 |
65 | (defvar lsp-json--major-modes '(json-mode jsonc-mode)
66 | "List of supported JSON major modes.")
67 |
68 | (defvar lsp-json--schema-associations
69 | `(:/*.css-data.json ["https://raw.githubusercontent.com/Microsoft/vscode-css-languageservice/master/docs/customData.schema.json"]
70 | :/package.json ["http://json.schemastore.org/package"]
71 | :/*.html-data.json ["https://raw.githubusercontent.com/Microsoft/vscode-html-languageservice/master/docs/customData.schema.json"]
72 | :/*.schema.json ["http://json-schema.org/draft-07/schema#"]
73 | :/bower.json ["http://json.schemastore.org/bower"]
74 | :/composer.json ["http://json.schemastore.org/composer"]
75 | :/tsconfig.json ["http://json.schemastore.org/tsconfig"]
76 | :/tsconfig.*.json ["http://json.schemastore.org/tsconfig"]
77 | :/typings.json ["http://json.schemastore.org/typings"]
78 | :/.bowerrc ["http://json.schemastore.org/bowerrc"]
79 | :/.babelrc ["http://json.schemastore.org/babelrc"]
80 | :/.babelrc.json ["http://json.schemastore.org/babelrc"]
81 | :/babel.config.json ["http://json.schemastore.org/babelrc"]
82 | :/jsconfig.json ["http://json.schemastore.org/jsconfig"]
83 | :/jsconfig.*.json ["http://json.schemastore.org/jsconfig"]
84 | :/project.json ["http://json.schemastore.org/project"]
85 | :/omnisharp.json ["http://json.schemastore.org/omnisharp"]
86 | :/.eslintrc.json ["http://json.schemastore.org/eslintrc"]
87 | :/.eslintrc ["http://json.schemastore.org/eslintrc"])
88 | "Default json schemas.")
89 |
90 | (defun lsp-json--get-content (_workspace uri callback)
91 | "Get content from URI."
92 | (ignore-errors
93 | (url-retrieve uri
94 | (lambda (_status callback)
95 | (goto-char (point-min))
96 | (re-search-forward "\n\n" nil 'noerror)
97 | (funcall
98 | callback
99 | (decode-coding-string (buffer-substring (point) (point-max))
100 | 'utf-8-unix)))
101 | (list callback))))
102 |
103 | (lsp-dependency 'vscode-json-languageserver
104 | '(:system "vscode-json-languageserver")
105 | '(:npm :package "vscode-json-languageserver"
106 | :path "vscode-json-languageserver"))
107 |
108 | (lsp-register-client
109 | (make-lsp-client
110 | :new-connection
111 | (lsp-stdio-connection
112 | (lambda () (list (lsp-package-path 'vscode-json-languageserver) "--stdio")))
113 | :major-modes lsp-json--major-modes
114 | :server-id 'json-ls
115 | :priority -1
116 | :multi-root t
117 | :completion-in-comments? t
118 | :initialization-options lsp-json--extra-init-params
119 | :async-request-handlers (ht ("vscode/content" #'lsp-json--get-content))
120 | :initialized-fn
121 | (lambda (w)
122 | (with-lsp-workspace w
123 | (lsp--set-configuration
124 | (ht-merge (lsp-configuration-section "json")
125 | (lsp-configuration-section "http")))
126 | (lsp-notify "json/schemaAssociations" lsp-json--schema-associations)))
127 | :download-server-fn
128 | (lambda (_client callback error-callback _update?)
129 | (lsp-package-ensure 'vscode-json-languageserver callback error-callback))))
130 |
131 | (provide 'lsp-json)
132 | ;;; lsp-json.el ends here
133 |
--------------------------------------------------------------------------------
/clients/lsp-vhdl.el:
--------------------------------------------------------------------------------
1 | ;;; lsp-vhdl.el --- VHDL Client settings -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2019 Christian Birk Sørensen
4 |
5 | ;; Author: Christian Birk Sørensen
6 | ;; Created: 6 October 2019
7 | ;; Keywords: languages, lsp, vhdl
8 |
9 | ;; This program is free software; you can redistribute it and/or modify
10 | ;; it under the terms of the GNU General Public License as published by
11 | ;; the Free Software Foundation, either version 3 of the License, or
12 | ;; (at your option) any later version.
13 |
14 | ;; This program is distributed in the hope that it will be useful,
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ;; GNU General Public License for more details.
18 |
19 | ;; You should have received a copy of the GNU General Public License
20 | ;; along with this program. If not, see .
21 |
22 | ;;; Commentary:
23 |
24 | ;; LSP support for VHDL using using an external language server. Currently
25 | ;; the supported servers are:
26 | ;;
27 | ;; VHDL-tool. See http://www.vhdltool.com/configuration for setting up the
28 | ;; project file.
29 | ;;
30 | ;; HDL Checker. See https://github.com/suoto/hdl_checker/wiki/setting-up-a-project
31 | ;; for setting up the project file.
32 | ;;
33 | ;; VHDL LS. See https://github.com/kraigher/rust_hdl#configuration for setting
34 | ;; up the project file.
35 | ;;
36 | ;; GHDL LS. See https://github.com/ghdl/ghdl-language-server for setting up the
37 | ;; project file.
38 | ;;
39 | ;; Set the symbol lsp-vhdl-server to select the language server and set
40 | ;; lsp-vhdl-server-path if the binary is not in the user PATH.
41 |
42 | ;;; Code:
43 |
44 | (require 'lsp-mode)
45 |
46 | (defvar vhdl-tool-bin-name "vhdl-tool"
47 | "Name of the VHDL Tool binary.")
48 |
49 | (defvar hdl-checker-bin-name "hdl_checker"
50 | "Name of HDL Checker binary.")
51 |
52 | (defvar vhdl-ls-bin-name "vhdl_ls"
53 | "Name of the VHDL LS binary.")
54 |
55 | (defvar ghdl-ls-bin-name "ghdl-ls"
56 | "Name of the GHDL LS binary.")
57 |
58 | (defgroup lsp-vhdl nil
59 | "LSP support for VHDL. Set lsp-vhdl-server to select server. The default is to use VHDL-tool."
60 | :group 'lsp-mode)
61 |
62 | (defcustom lsp-vhdl-server 'vhdl-tool
63 | "Select which server to use:
64 | VHDL-tool: A syntax checking, type checking and linting tool (http://vhdltool.com).
65 | HDL Checker: A wrapper for third party tools such as GHDL, ModelSim, Vivado Simulator (https://github.com/suoto/hdl_checker).
66 | VHDL LS: A complete VHDL language server protocol implementation with diagnostics, navigate to symbol, find all references etc. (https://github.com/kraigher/rust_hdl)."
67 | :type '(choice (const :tag "VHDL-tool" vhdl-tool)
68 | (const :tag "HDL Checker" hdl-checker)
69 | (const :tag "VHDL LS" vhdl-ls)
70 | (const :tag "GHDL LS" ghdl-ls))
71 | :group 'lsp-vhdl)
72 |
73 | (defcustom lsp-vhdl-server-path nil
74 | "Path to binary server file."
75 | :group 'lsp-vhdl
76 | :risky t
77 | :type 'file)
78 |
79 | (defvar lsp-vhdl--params nil)
80 |
81 | (defun lsp-vhdl--create-connection ()
82 | "Returns lsp-stdio-connection based on the selected server"
83 | (lsp-vhdl--set-server-path)
84 | (lsp-vhdl--set-server-args)
85 | (lsp-stdio-connection
86 | (lambda () (cons (plist-get lsp-vhdl--params 'server-path) (plist-get lsp-vhdl--params 'server-args)))
87 | (lambda () (executable-find (plist-get lsp-vhdl--params 'server-path)))))
88 |
89 | (defun lsp-vhdl--set-server-path()
90 | "Set path to server binary based on selection in lsp-vhdl-server."
91 | (cond ((eq lsp-vhdl-server 'hdl-checker) (if (eq lsp-vhdl-server-path nil)
92 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path hdl-checker-bin-name))
93 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))
94 | ((eq lsp-vhdl-server 'vhdl-tool) (if (eq lsp-vhdl-server-path nil)
95 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path vhdl-tool-bin-name))
96 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))
97 | ((eq lsp-vhdl-server 'vhdl-ls) (if (eq lsp-vhdl-server-path nil)
98 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path vhdl-ls-bin-name))
99 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))
100 | ((eq lsp-vhdl-server 'ghdl-ls) (if (eq lsp-vhdl-server-path nil)
101 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path ghdl-ls-bin-name))
102 | (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))))
103 |
104 | (defun lsp-vhdl--set-server-args()
105 | "Set server arguments based on server selection."
106 | (cond ((eq lsp-vhdl-server 'hdl-checker) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '("--lsp"))))
107 | ((eq lsp-vhdl-server 'vhdl-tool) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '("lsp"))))
108 | ((eq lsp-vhdl-server 'vhdl-ls) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '())))
109 | ((eq lsp-vhdl-server 'ghdl-ls) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '())))))
110 |
111 | (lsp-register-client
112 | (make-lsp-client :new-connection (lsp-vhdl--create-connection)
113 | :major-modes '(vhdl-mode)
114 | :language-id "VHDL"
115 | :priority -1
116 | :server-id 'lsp-vhdl))
117 |
118 | (provide 'lsp-vhdl)
119 | ;;; lsp-vhdl.el ends here
120 |
--------------------------------------------------------------------------------