VScode IntelliSense very frustrating

I am long time Juno user. I keep coming back to VScode as that is supposedly where things are going. Everytime I come back the intellisense never works. Half the time when you import namspaces with the using statement the methods will not auto populate. I want use VScode but auto completion is such basic feature these days if doesn’t work I am just not going to use it. This concerns me because I know at some point Juno will stop existing. Does anyone else have these problems or is there something I am missing?

2 Likes

There are definitely things I’m missing with VSCode autocomplete (although @pfitzseb might hit me over the head if I bring up autocompletion of DataFrame columns names again…), but could you give a more specific example of what isn’t working?

I understand your post to be talking about autocompletion of methods defined in a package like this:

image

Here combine and completecases are defined in DataFrames. Is this what isn’t working for you? You say “half the time”, so maybe there’s something special about the cases where it isn’t working?

The most important thing for getting intellisense for packages is that the environment selected in the lower left of the status bar is correct (in the sense that it contains whatever packages you’re trying to load).

Thank you both for your reply.

I see now at the bottom of VScode were the environment is. Once I chose this, I saw it that it indexed the namespaces. When I used Juno I used a small script to automate the environment start up and Juno automatically detected the environment. I didn’t realize VScode was not, since in terminal the environment was displayed correctly. For now this seems to a vast improvement to my experience. Sorry I guess I just looked over a small thing.

1 Like

Yeah, the main issue is that there are two separate “environments” in VS Code. Glad things are working for you now.

Something that doesn’t work quite well for me is path completion, e.g. if I start typing CSV.read("tem it correctly gives me CSV.read("templates but then I type / and it gives me nothing, only when I close the " it lists the files in the directory and wrongly insert them after the quote.

Hm, that works fine for me. Are you on Windows? Anyways, please open issues for things like that.

On mac, I realised I wasn’t even in the right directory, but it still correctly list the files there somehow (I guess because they are in my VS workspace). It doesn’t work much better with the right folder though.

The completions for include etc should always be relative to the file path, not anything related to the Julia runtime state.

I noticed that the intellisense works in src/ with my defined module. Unfortunately, in the test folder the intellesense does not work. This makes it cumbersome write test when none of the module your are writing autocomplete. Is there any workaround or solution to this?

has there been any fix to this? I also find this annoying and it costs time.

As far as I can tell no. You can dev the package your developing ( which you should do anyway.) You can use the using statement in the test environment. Again though it get kind of hairy when you split thing into multiple files for organization. I have gotten the habit of keeping two instances vs code open so I can see the functions. Also you need to remember to export you public functions. Your private ones will never autocomplete in my experience. Again I might be doing something wrong but I have never gotten straight answer on this from community.

When program in C# I never have such issues. I don’t know this isn’t fixed. If you have imported the names space in a project in your workspace in should be available to you.

I’m having mixed issues. When working with my own package, imported with a using statement at the top of a file for running simple test programs, I can start typing a function name (that is loaded via an include in the main module file) and it will autocomplete. However, selecting “go to definition” will cause intellisense to fail with “no definition found…”. Likewise, hovering over the function, once typed out in full, will not pop up the docstring for the function.

In my case, I suspect this is perhaps due to me not organizing my project property. I want to avoid excessive namespaces, so I’m keeping everything in the namespace of the main module by having what would normally be submodules included instead. So in my main module file, I have include statements pointing to relative paths for other would-be modules, and those are little more than a set of include statements for the individual source files that export functions and structures and otherwise make up the would-be submodules.

However, even functions that are defined and exported in the main module file give “no definitions found…” and don’t show docstrings, even though the test program will run just fine. So the Julia runtime is finding everything fine; it’s just VS Code intellisense that’s missing things.

Edit: Interesting to note that in the Julia View, I can see my module, and when expanded I find all functions and structures listed, yet definitions and docstrings don’t load from within a source file. Nor do the module functions/structures show up in the documentation section of the Julia View.

Should we make a new thread for the issue of Intellisense for the current module not working in test files (separate from OP’s issue)? I am also having this specific problem. Even the module definition cannot be found in the using MyModule statement in the test file.

Workaround for now is to go to the module definition and locate the source of the exported symbol I’m interested in from there (as I am reading someone else’s code).

1 Like