Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to run elixir tests from test lenses #2407

Merged
merged 3 commits into from
Dec 15, 2020

Conversation

wkirschbaum
Copy link
Contributor

@wkirschbaum wkirschbaum commented Dec 14, 2020

Tests running code lenses are now provided by elixir-lsp elixir-lsp/elixir-ls#389 and implemented for vscode elixir-lsp/vscode-elixir-ls#155.

This adds the ability to switch on elixir test lenses and will run the tests using the compile function.

test-lens-preview

@github-actions github-actions bot added the client One or more of lsp-mode language clients label Dec 14, 2020

(defun lsp-elixir--build-test-command (argument)
"Builds the test command from the ARGUMENT."
(let ((test-name (gethash "testName" argument))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using gethash is not allowed. All the access to the data structures that come from the language server should happen either by defined lsp-interface or by using lsp-get. This will allow us to migrate to using plists instead of hashtables. You may refer to rust-analyzer for example: https://github.com/yyoncho/lsp-mode/blob/headerline-errors/lsp-protocol.el#L278

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will have a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyoncho I changed to lsp-get, but will figure out how lsp-interface works tomorrow if it might be a better fit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lsp-get is good enough for non-core components given the fact that this structure will be accessed only in a few places.

As a side note, most likely vscode supports running the tests in the debugger, right? We can implement that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean dap-mode? I have not really worked with it before, but can have a look. Ideally i would not want to click to run tests, but this is the baseline work for future capabilities it seems.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean dap-mode?

yes.

Ideally i would not want to click to run tests, but this is the baseline work for future capabilities it seems.

There is lsp-avy-lens. And then you will be able to re-run with M-x recompile.

@yyoncho yyoncho merged commit d788a13 into emacs-lsp:master Dec 15, 2020
@yyoncho
Copy link
Member

yyoncho commented Dec 15, 2020

Thank you for contributing to lsp-mode!

@wkirschbaum
Copy link
Contributor Author

@yyoncho @axelson thanks for helping me contribute.

@wkirschbaum wkirschbaum deleted the elixir-run-tests branch December 15, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client One or more of lsp-mode language clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants