Windows vs code move 1.0.18 intellisense

@awelc hi, since I can’t reply more because of the reply limit at issue 44762.

I created this new issue.

Here is my setup.

Installed latest sui binary for windows.
sui -V → sui 1.45.0-3ef5cc5b5c90

Installed latest Move extension which is 1.0.18.
Move: Show Server Version → move-analyzer 1.46.0-132d896b46a8
Cleared .move folder.

Created a new module for sample todo_list which was a tutorial at move-book (5-Hello Sui)

Opened the folder with vs code, no popup error.
It also builds successfully, without no freeze.

All good up to now.

But I see some intellisense problems.
For example when I write list. it can’t see that it has a items property, which is annoying.

I remember intellisense was working for this scenario a few versions before.

Any idea how to solve intellisense?

4 Likes

By the way, with this sui version (v1.45.0) , I see this change

#21204: Implicitly added dependencies on system packages (MoveStdLib, Sui, System, DeepBook, and Bridge) if they are not included in Move.toml.

So now the generated Move.toml has no dependencies when it was generated initially by sui move new todo_list

Can this be related with intellisense issues?

2 Likes

Implicit dependencies should have nothing to do with it. From your screenshot, though, it appears that the Move extension is not enabled at all. Are you sure you re-enabled it after the update? The reason I think that you only have syntax highlighting enabled only is that I don’t see any warnings/errors displayed which you should have (e.g., list. is incomplete and should be underlined by red squiggly, item is unused and should be reported as such with yellow squiggly, etc.). This is how it looks in my VSCode instance running Move 1.0.18 (I am assuming that TodoList is a struct and you are referring to accessing its fields)

2 Likes

Let me paste full code (which I took from move-book).


module todo_list::todo_list;

use std::string::String;

public struct TodoList has key, store {
    id: UID,
    items: vector<String>,
}

public fun new(ctx: &mut TxContext): TodoList {
    let list = TodoList {
        id: object::new(ctx),
        items: vector[],
    };

    list
}

public fun add(list: &mut TodoList, item: String) {
    list.items.push_back(item);
}

Do you see items when you type list.?

2 Likes

Thank you for the detailed repro instructions! Previously, I could not see what’s on the second line of the add function as it was obstructed by the auto-completion menu.

Indeed, intellisense is not working properly here for me either. However it’s an artifact of a more general issue rather than a simple bug. When auto-completing, you typically operate in a context of a compiler error (as, for example, list. is not a valid Move expression, at least not yet, and the compiler will treat it as an error). At the same time, in order to provide some meaningful auto-completion content, the compiler needs to know at least partially what an expression such as list. is or is going to be - in particular it needs to know its type. So, the compiler is trying to make sense of list. but there is also code following it that may affect is meaning. In the particular example you provided, the compiler sees something like this (line breaks do not matter to it): list.list.items.push_back(item) and it’s very confused about the initial list.list as it looks like a valid expression but is not. If you try a function with just the list. (see below), however, the compiler is smart enough to figure out that list.} does not make much sense and can take a more meaningful action at the dot (an intellisense will work in this case):

public fun add(list: &mut TodoList, item: String) {
    list.
}

Long story short, I will look into this particular case to see if I can finesse it so that intellisense produces a more meaningful auto-completion for this, but there always be cases when it does not…

All that being said, you should still see compiler diagnostics in VSCode (red squigglies):

Me not seeing them in your screenshot makes me worried that the extension is not enabled or is not working properly. Can you see on-hover info for well-defined constructs, such as add function?

Perhaps you could attach the content of Move tab in View->Output window? It should contain something like this (compilation failure at the later stage is expected due to incomplete expression):

2 Likes

This particular problem was fixed in VSCode extension v1.0.19

3 Likes

I am back, tried with move extension 1.0.20, and it seems it is fixed when using WSL on windows. Also tried in local window, but intellisense doesn’t work there. But I can continue development in WSL. Thanks for your support.

1 Like

I am glad it works using WSL, Not sure what “local window” means, though, and I would be grateful if you could explain. I am keen to fix all problems, particularly if you can continue providing repro instructions

1 Like

I meant windows itself, where I run the WSL