MaskRay / vscode-ccls

ccls plugin for Visual Studio Code
123 stars 37 forks source link

Add support for semantic navigation #3

Closed icylogic closed 6 years ago

icylogic commented 6 years ago

semantic-navigation

Implementing semantic navigation.

icylogic commented 6 years ago

Note: You could set your own key bindings to these commands:

        "command": "ccls.navigateFirstChild"
        "command": "ccls.navigateParent"
        "command": "ccls.navigatePrevious"
        "command": "ccls.navigateNext"

If you are using VSCodeVim like I do, consider mapping keys in settings.json:

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["<leader>", "j"],
            "commands": ["ccls.navigateNext"]
        },
        {
            "before": ["<leader>", "k"],
            "commands": ["ccls.navigatePrevious"]
        },
        {
            "before": ["<leader>", "h"],
            "commands": ["ccls.navigateParent"]
        },
        {
            "before": ["<leader>", "l"],
            "commands": ["ccls.navigateFirstChild"]
        }
    ]
MaskRay commented 6 years ago

I introduced $ccls/navigate before https://github.com/MaskRay/ccls/releases/tag/0.20180913 and put the generic ccls-navigate (but not the 4 variants) into emacs-ccls (https://github.com/MaskRay/ccls/wiki/Emacs#ccls-navigate) because Emacs users tend to have different customization needs. It is also easy to bind keys in Vim/Neovim with LanguageClient-neovim (https://github.com/MaskRay/ccls/wiki/LanguageClient-neovim#cclsnavigate).

I understand that VSCode users may be more accustomed to predefined commands in a menu...

Is it easy to send other custom requests in VSCode? @Riatre

Riatre commented 6 years ago

The problem here is when executing VSCode commands with Ctrl+Shift+P (it's like M-x in Emacs), it is not possible to specify arguments (you can in keybindings though). But I don't think those navigation commands are useful without a keybinding so I agree with @MaskRay in that this should be implemented as a single ccls.navigate command.

And yes, it is easy to send other custom requests.

icylogic commented 6 years ago

OK, I'll fix it next week. I need to add some documentation so users know how to use it.

@Riatre You can let user quickly pick an option from a list or input some text after your command is invoked. Just like what GitLens do when Show File History is called.

icylogic commented 6 years ago

closed in favor of #8