OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

Go to next class (]c) does not support records and structs #864

Closed marcinjahn closed 5 months ago

marcinjahn commented 5 months ago

The command ]c should jump to the next type definition in a file. It properly navigates between classes. However, unfortunately, it skips records and structs entirely.

Is it by design? I think it'd make sense to make it work for classes, structs and records.

nickspoons commented 5 months ago

Where is your ]c mapping coming from (:verbose map <buffer> ]c)? OmniSharp-vim doesn't define this mapping.

If you're referring to :OmniSharpNavigateDown, that behaviour is specified by the server, so would have to be changed on the OmniSharp-roslyn side. However, testing it quickly just now, while you're right that it does skip record definitions, it still navigates to record properties, and struct definitions and properties. So here:

public struct MyStruct {
    private int structVar;
    public string StructProp { get; }
}

public record MyRecord {
    private int recordVar = 9;
    public string RecordProp { get; }
}

Navigating through with :OmniSharpNavigateDown/:OmniSharpNavigateUp we stop on MyStruct, structVar, StructProp, recordVar and RecordProp. The only place it doesn't stop is on MyRecord.

marcinjahn commented 5 months ago

I'm using neovim, more specifically lazyvim. I just checked and it actually installs https://github.com/Hoffs/omnisharp-extended-lsp.nvim, so I suppose I should rather create this issue in that repo instead. Am I right?

Not sure if :OmniSharpNavigateDown is the same thing, probably not. The action I'm referring to (no idea how it's called internally) is displayed as follows in the UI:

image

marcinjahn commented 5 months ago

I realized that the proper place to submit the issue is https://github.com/nvim-treesitter/nvim-treesitter-textobjects. Closing.