+
Skip to content

GotoDefinition kind of functions may not trigger FileType autocommands #681

@torimus

Description

@torimus

Handlers of LSP requests like textDocument/definition, textDocument/declaration etc open other files content in a new buffer, using sequence of bufadd and bufload functions. In some cases, still not sure about the exact cause, this way created buffers do not trigger autocommands assigned to their particular filetype. This applies for example to gopls Go language server.

Handlers for above mentioned requests use auxiliary function GotoSymbolLoc which through DecodeLocation first creates a new buffer with LspUriToBufnr, next loads its content with bufload in DecodePosition as part of the call chain. The latter effectively prevents filetype plugin code to be executed. If commented out, entering the target buffer is enough to load its contents and trigger filetype related code.

It may also be a bug in Vim, still unclear.

Vim version: 9.1.1734

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载