VSCode Intellisense Issue

We have a java library written by our team and imported into our VSCode projects. The library works fine and the intellisense feature works except for the following issue. If you have a line of code like this:

Util.consoleLog("after stop  hdg=%.2f  yaw=%.2f", 
                RobotContainer.navx.getHeading(), 
                RobotContainer.navx.getYaw());

If I hover over getYaw(), vscode displays the doc for the function as coded in the library source. If I hover over getHeading(), no doc is displayed. Both functions have doc defined. This appears all over our library, some functions display the expected doc and some don’t. Can’t tell what makes it work vs not working.

How are you importing the library? As a vendordep?

1 Like

First of all, if navx is of type AHRS (the class for the NavX), then it doesn’t have a getHeading() function - it’s getYaw() and/or getAngle(). If it’s a custom class, then it’s an issue with your library, the way you’re including it, or VS Code Intellisense (which is terrible anyway).


Apart from that, why do you have your gyro as a static field in RobotContainer? You shouldn’t really have statics in robot code, there isn’t a good use of it (except for util functions).

Yes.

Why not? (It is a utility function in my mind).

The general convention is to encapsulate hardware objects inside the subsystem classes. The RobotContainer shouldn’t have anything static, it’s only purpose is initializing default commands, buttons, and the autonomous command; and all of these are non-static.

Is this issue only with VS Code Intellisense or does the project not build? Any chance for a github link or something?

I see your point about static, but that is a convention. If static in subsystem or static in container, it works the same. I put it in container because I waffled on if to consider the navx device part of the drive base subsystem or not. What made the choice is the fact that I use the navx all over in the code in tracing what is going on and it appears in a couple classes that don’t have a reference to the drive base. I am going to review that decision.

As to the intellisense issue, it is only VSCode displaying the doc for a class method in our library. Project builds fine. No github involvement I am aware of. Since some doc for some methods displays fine and not for other methods in the same library class and the problem appears in multiple library classes and this works correctly in Eclipse, I am going to assume it is a problem with VSCode.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.