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 basic language server support for explicit symbol imports #3282

Merged
merged 22 commits into from
Jun 4, 2022

Conversation

rvanasa
Copy link
Contributor

@rvanasa rvanasa commented Jun 2, 2022

This PR adds straightforward "go to definition" support for Motoko's pattern-style import syntax.

For example, import { v|als } "mo:base/Array" and v|als(x) (where | represents the cursor) will correctly navigate to the corresponding Array.vals declaration.

As with existing language server functionality, these changes do not yet account for variable shadowing. However, the updated parse_module_header function already parses import patterns such as (import {alias = field} "...") based on the proposed generalized import syntax (#3076).

Please let me know if additional explanation would be helpful for any of these changes. I also included four test cases to cover the newly expected behavior of definition_handler and parse_module_header.

Tested in VSCode on WSL using the official Motoko extension.

Fixes #3078
Supersedes #3263

CC @kritzcreek, @crusso, @matthewhammer

rvanasa and others added 15 commits May 23, 2022 14:47
Ignores project config files and directories generated by VSCode, IntelliJ-based IDEs, Eclipse, Vim, etc. 

Adding as a PR since this tends to be a reasonably common practice for open-source repositories. These specific entries are from the `.gitignore` in [rust-lang/rust](https://github.com/rust-lang/rust/blob/master/.gitignore#L13-L23).
## Changelog for ic-hs:
Branch: master
Commits: [dfinity/ic-hs@b7bbd5db...998a0084](dfinity/ic-hs@b7bbd5d...998a008)

* [`691b2847`](dfinity/ic-hs@691b284) Use nixbuild.net as a remote nix builder on CI ([dfinity/ic-hs⁠dfinity#81](https://togithub.com/dfinity/ic-hs/issues/81))
* [`27320521`](dfinity/ic-hs@2732052) .github/workflows/release.yml: disable MacOS builds in release job ([dfinity/ic-hs⁠dfinity#82](https://togithub.com/dfinity/ic-hs/issues/82))
* [`998a0084`](dfinity/ic-hs@998a008) feat: allow optional "error_code" field in responses ([dfinity/ic-hs⁠dfinity#75](https://togithub.com/dfinity/ic-hs/issues/75))
@ghost ghost added the cla:agreed label Jun 2, 2022
@crusso
Copy link
Contributor

crusso commented Jun 2, 2022

Thanks @rvanasa these contributions are much appreciated. I won't get a chance to review today but perhaps someone else will.

Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ggreif ggreif added the automerge-squash When ready, merge (using squash) label Jun 4, 2022
@mergify mergify bot merged commit 209bc04 into dfinity:master Jun 4, 2022
@mergify mergify bot removed the automerge-squash When ready, merge (using squash) label Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

languageServer support for explicit symbol imports
4 participants