Giter Site home page Giter Site logo

Comments (4)

manateelazycat avatar manateelazycat commented on June 20, 2024

You can temporarily turn on the log through the lsp-bridge-enable-log option. The log can be seen in the *lsp-bridge* buffer.

If after the lsp-bridge-find-def command is executed, clangd returns the defined log but lsp-bridge does not jump correctly, then it is a bug of lsp-bridge. You are welcome to submit the log and I will fix it.

If clangd does not return the defined location in the log, that is a problem with clangd, lsp-bridge just obeys the information returned by the lsp server to perform the operation

from lsp-bridge.

vincentjgoh avatar vincentjgoh commented on June 20, 2024

I already had the logging turned on, but I noticed that it had stopped giving me any output. I closed it and it eventually started again, giving me warnings that the index might be incomplete. Is there any way to force the index to be built to completion? I don't remember having this issue before.

Anyway, I suspect that the issue might be an incomplete index. When I switched from lsp-mode to lsp-bridge, I had to delete the cache because they're using different clangd installs, and the one that lsp-bridge picks up is an older revision. Though it's still confusing that finding the symbol works and jumping to the class by finding the definition doesn't. I'll update this thread once the index has finished building.

FWIW, this is what happens when I try to look up the definition for the class AActor, a common class in the Unreal Engine:

--- [20:05:40.971285] Send textDocument/definition request (15594) to 'clangd' for project 
I[20:05:40.972] --> reply:textDocument/definition(15594) 0 ms
{
   "id": 15594,
   "method": "textDocument/definition",
   "params": {
      "position": {
         "line": 32,
         "character": 61
      },
      "textDocument": {
         "uri": "file:///d%3A/p4v/Dev/Engine/Plugins/WeaponSystem/Source/SystemRuntime/Public/Actors/WeaponVisualActor.h"
      }
   },
   "message_type": "request",
   "jsonrpc": "2.0"
}

--- [20:05:40.971285] Recv textDocument/definition response (15594) from 'clangd' for project 
Eval in Emacs: (lsp-bridge-find-def-fallback '(:line 32 :character 61))
{
   "id": 15594,
   "jsonrpc": "2.0",
   "result": []
}

I get a tremendous amount of data back from lsp-bridge-workspace-list-symbols, though.
I'll just include one of the entries, but there's about 1900 lines of JSON results in the log. The duplication is in the log, it's not a copy paste error. But what's being found in this case is a constructor, so I would guess that's why this is happening?

      {
         "containerName": "AActor",
         "kind": 9,
         "location": {
            "range": {
               "end": {
                  "character": 14,
                  "line": 109
               },
               "start": {
                  "character": 8,
                  "line": 109
               }
            },
            "uri": "file:///D:/p4v/Dev/Engine/Source/Runtime/Engine/Private/Actor.cpp"
         },
         "name": "AActor",
         "score": 0.5
      },
      {
         "containerName": "AActor",
         "kind": 9,
         "location": {
            "range": {
               "end": {
                  "character": 14,
                  "line": 104
               },
               "start": {
                  "character": 8,
                  "line": 104
               }
            },
            "uri": "file:///D:/p4v/Dev/Engine/Source/Runtime/Engine/Private/Actor.cpp"
         },
         "name": "AActor",
         "score": 0.5
      },

from lsp-bridge.

vincentjgoh avatar vincentjgoh commented on June 20, 2024

Actually, I'll ask that question while I'm here anyway: what's the easiest way to change the path that lsp-bridge uses when it starts the language server?

I have 2 versions of clangd installed on my machine. Unreal prefers v14, and so that's the system default. I have v17 installed because it's newer, and my emacs paths are set to start that up. For lsps like lsp-mode and eglot, this is fine, since they use whatever emacs finds (or I can set the path manually).

I don't actually know python, but I looked through it quickly and I THINK what's happening is it tries to merge emacs' exec-path to the system paths, but crucially, it adds the emacs paths AFTER the system paths, so it's always going to pick up the wrong LSP for me. You can let me know if I'm right or wrong here. :)

from lsp-bridge.

manateelazycat avatar manateelazycat commented on June 20, 2024

The lsp server configuration of lsp-bridge is in the langserver directory. For example, clangd is lspbridge/langserver/clangd.json

clangd.json only writes the clangd name, it will find clangd from the system directory. If you want to customize the version of clangd, you can customize lsp-bridge-get-single-lang-server-by-project, according to project- path and filename return a customized json file path. The content of the json path can be the same as lspbridge/langserver/clangd.json, except that "clangd" in clangd.json is replaced with the clangd path you specify.

from lsp-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.