RuboCop offenses are not highlighted in VSCodium when project is loaded from workspace

80 views Asked by At

I use Ruby LSP to lint Ruby code with RuboCop in VSCodium.

When I open the editor either from the console:

$ codium .

or from the command dialog (alt + F2), any offenses found are properly highlighted:

RuboCop highlights offenses

However, when I load that same project after switching workspaces (with vscode-workspace-switcher extension), nothing is highlighted:

RuboCop does not highlight offenses

It's like some kind of context is missing when the workspace is loaded.

Does anybody know how to solve this?

Thanks in advance.

1

There are 1 answers

0
backpackerhh On BEST ANSWER

Finally I found a solution, although I'm not sure why a configuration works and the other one does not.

As I said, I'm using the extension vscode-workspace-switcher to switch between different workspaces in VSCodium.

The code-workspace file for my project was something like following:

{
    "folders": [
        {
            "path": "../<path/to/my/project>"
        }
    ],
    "settings": {}
}

Notice path is a relative path to where the project is placed.

However, by chance I realized that when RuboCop offenses were properly displayed in the editor, the path to those files were something like /media/david/<path/to/the/file>.

So I changed the configuration in the code-workspace file as follows:

{
    "folders": [
        {
            "path": "/media/david/<path/to/my/project>"
        }
    ],
    "settings": {}
}

I went back to the project and now RuboCop offenses are properly displayed in the editor.

By the way, it doesn't work with ~/<path/to/my/project> nor /home/david/<path/to/my/project>.