Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

No autocompletion with nested attribute declaration #91

Open
jiegec opened this issue Jul 6, 2022 · 0 comments
Open

No autocompletion with nested attribute declaration #91

jiegec opened this issue Jul 6, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jiegec
Copy link

jiegec commented Jul 6, 2022

Describe the bug

Example code:

let ab = { cd.ef = 2; }; in ab.cd.

It does not autocomplete ef.

Steps to reproduce

Steps to reproduce the behavior:

Add the following test to src/lookup.rs:

    fn test_ident_traverse_multi_attr_path() {
        let root = rnix::parse("let ab = { cd.ef = 2; }; in ab.cd. ").node();
        let mut app = App {
            files: HashMap::new(),
            conn: Connection::memory().0,
        };

        let suggestions = app.scope_for_ident(
            Url::parse("file:///default.nix").unwrap(),
            &root,
            34
        );

        assert!(suggestions.is_some());
        let val = suggestions.unwrap();
        assert!(val.1.contains_key("ef"));
    }

It fails.

Expected behavior

It should handle attrs like { cd.ef = 2; }.

Screenshots

The problem was found when trying to jump to declaration of passthru.optional-dependencies.socks:

image

It fails to jump to the attribute.

Additional context

  • Version of rnix-lsp: 0.2.5
  • Name and version of the editor you've used: VSCode 1.68.1
  • Operating system: macOS
Editor configuration "nix.enableLanguageServer": true
@jiegec jiegec added the bug Something isn't working label Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant