Comments (39)
lsp-bridge-enable-log 选项关闭以后会正常吗?因为这个选项只是调试用的,打开会极度影响性能
from lsp-bridge.
lsp-bridge-enable-log关闭后也是这个状况。
from lsp-bridge.
给一个最小的重新代码吧,我有空测试一下
from lsp-bridge.
package main
import (
"fmt"
"time"
"github.com/gin-gonic/gin"
)
func main() {
a := 2
for a == 2 {
time.Sleep(1 * time.Second)
a = 3
}
fmt.Println("--> a = 3")
r := gin.Default()
r.Run(":8080")
}
from lsp-bridge.
Can confirm a similar issue with gopls
When I use arrow-key to navigate the candidate list, the list will disapear and then I cannot autocomplete anymore.
from lsp-bridge.
lsp-bridge-go-issue.mov
from lsp-bridge.
@haoran-mc 我今天晚上测试了一下, 一直都是可以补全的。
我看了你的 lsp-bridge.txt 日志, 你只有第一次 textDocument/completion 请求有回应, 第二次就不行了。
你的 golang 项目是按照我README写的: 补全之前执行 go mod init 命令
这样做的吗?
我的 gopls 是直接通过 pacman 安装的, 版本是 0.15.2-1
from lsp-bridge.
❯ go mod init github.com/haoran-mc/testlsp
go: creating new go.mod: module github.com/haoran-mc/testlsp
❯ nvim main.go
❯ cat main.go
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: main.go
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ package main
2 │
3 │ import "github.com/gin-gonic/gin"
4 │
5 │ func main() {
6 │ r := gin.Default()
7 │ r.Run(":8080")
8 │ }
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ go mod tidy
go: finding module for package github.com/gin-gonic/gin
go: found github.com/gin-gonic/gin in github.com/gin-gonic/gin v1.9.1
❯ cat go.mod
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: go.mod
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ module github.com/haoran-mc/testlsp
2 │
3 │ go 1.22.1
4 │
5 │ require github.com/gin-gonic/gin v1.9.1
6 │
7 │ require (
| ...
32 │ )
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
项目是这样搭建的,因为 emacs 现在不能补全,所以暂时使用 nvim 编辑。
nvim 中的 gopls 会提示:
/Users/haoran/testlsp/go.mod:3: invalid go version '1.22.1': must match format 1.23 [Error loading workspace]
然后我就把 go.mod 第三行的 1.22.1 改成了 1.22。
这时 nvim 能正常工作,但是 emacs 会出现上面补全消失的情况。
之后把 go.1.22 修改回 go.1.22.1 emacs 也还是补全消失。
❯ gopls version
golang.org/x/tools/gopls v0.15.1
我是使用 go install golang.org/x/tools/gopls@latest 下载的 gopls。
from lsp-bridge.
我按照你上面的步骤构建golang项目, 可以工作。
你的配置是只加载了 lsp-bridge 吗? 还是有别的配置在影响 lsp-bridge 或 acm ?
from lsp-bridge.
@manateelazycat Can you try this repo: https://github.com/kubernetes/kubernetes
Not working for me. gopls 0.15.2
from lsp-bridge.
我的配置只有这些,放在 ~/.emacs 文件中,然后删除了 ~/.emacs.d 文件夹。
(setq debug-on-error t)
(add-to-list 'load-path "~/Documents/emacs/local-packages/markdown-mode")
(require 'markdown-mode)
(add-to-list 'load-path "~/Documents/emacs/local-packages/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
(add-to-list 'load-path "~/Documents/emacs/local-packages/go-mode.el")
(require 'go-mode)
(add-to-list 'load-path "~/Documents/emacs/local-packages/lsp-bridge")
(require 'lsp-bridge)
(global-lsp-bridge-mode)
(provide 'init)
今天测试发现上面用了 gin 的小 demo 可以补全了,重启多次也都可以正常补全。
然后我在 github 上找了一些仓库,二十多个,只有内部包的项目都可以补全。需要第三方库的项目,尽管只依赖一个第三方库也不能补全。
打开项目前我都进行了 go mod tidy。
from lsp-bridge.
感觉是gopls.json参数配置的问题,可以看一下vscode的gopls是怎么配置的
from lsp-bridge.
@jixiuf Can you help to fix this? Thanks. ;)
from lsp-bridge.
我遇到了同样的问题。MacOS(emacs29) 和 NixOS(emacs30) 中都遇到过。gopls v0.15.2, go v1.22.2。我使用了 go-mode-hook, emacs 会报错 function lsp-bridge is void。MacOS是新安装的环境,补全只在第一次打开项目起作用,之后就没有补全了。
from lsp-bridge.
我这里 go 的项目也无法补全了,同项目 eglot 是可以补全了, lsp-bridge 补全 c 也是可以的但是 go 不行
from lsp-bridge.
有问题的同学都提供一下最小重现代码吧, 我目前个人测试没有问题
from lsp-bridge.
我今天推送了新的补丁
这个补丁应该修复了LSP Server返回超多补全项时acm菜单不显示候选词的问题。
不显示补全的原因是, 原来有一批用户不希望 lsp-bridge 在 Python 端过滤候选词, 但是完全不过滤候选词, 当LSP server返回的候选词过多就会导致Emacs因为创建过多的对象而引起GC, 最终卡住Emacs, 所以后面引入了 acm-backend-lsp-candidates-max-number 选项来避免GC。
但是这样设计也是有问题的, 如果 LSP server 返回的候选词远远大于 acm-backend-lsp-candidates-max-number 的设定 (比如 Tailwindcss LSP server), 默认不过滤的策略, lsp-bridge 只是会一直发送 acm-backend-lsp-candidates-max-number 范围内的候选词, 而这些候选词和用户的输入并没有关系。
新的设计是, lsp-bridge 总是会在Python端过滤候选词, 只是用户可以配置 acm-backend-lsp-match-mode 的匹配模式, 这样就解决了LSP server返回过多候选项时acm不显示补全候选词的bug。
from lsp-bridge.
@haoran-mc @ydzhou @mrunhap @yuzukicat 这个帖子的大佬们, 你们可以更新到最新版帮我验证一下这个问题还存在吗?
from lsp-bridge.
@manateelazycat 已更新到最新版,问题还存在。还是等待几分钟就可以正常补全。
from lsp-bridge.
等几分钟才能补全, 是不是 gopls 在后台下载库或者再做目录索引的工作呀? 能否帮我打开日志, 看一下 *lsp-bridge*
的内容?
我是最近在修复 Tailwindcss 的问题的时候, 想到可能也能修复 gopls 的问题。
from lsp-bridge.
是的,代码越多、需要的库越多,等待的时间越长。 几分钟、十几分钟、二十几分钟... 之后能一直正常使用。
*lsp-bridge*
: lsp.log
[yas] Prepared just-in-time loading of snippets (but no snippets found).
Waiting for git... [2 times]
For information about GNU Emacs and the GNU system, type C-h C-a. [2 times]
Making completion list...
[LSP-Bridge] found language server: /Users/haoran/go/bin/gopls
[LSP-Bridge] Active project ’dockertest’, enjoy hacking!
Mark set [2 times]
Mark activated
Mark set [2 times]
Saving file /Users/haoran/gotest/dockertest/container.go...
Wrote /Users/haoran/gotest/dockertest/container.go
[LSP-Bridge] Process terminated.
[LSP-Bridge] Process restarted.
[LSP-Bridge] found language server: /Users/haoran/go/bin/gopls
[LSP-Bridge] Active project ’dockertest’, enjoy hacking!
Mark set [2 times]
Saving file /Users/haoran/lsp.log...
Wrote /Users/haoran/lsp.log
previous-line: Beginning of buffer
(No changes need to be saved)
from lsp-bridge.
好的, 我分析一下日志, 看看能否加一下提示, 目前看代码补全可以用了。
from lsp-bridge.
是的,代码越多、需要的库越多,等待的时间越长。 几分钟、十几分钟、二十几分钟... 之后能一直正常使用。
*lsp-bridge*
: lsp.log[yas] Prepared just-in-time loading of snippets (but no snippets found). Waiting for git... [2 times] For information about GNU Emacs and the GNU system, type C-h C-a. [2 times] Making completion list... [LSP-Bridge] found language server: /Users/haoran/go/bin/gopls [LSP-Bridge] Active project ’dockertest’, enjoy hacking! Mark set [2 times] Mark activated Mark set [2 times] Saving file /Users/haoran/gotest/dockertest/container.go... Wrote /Users/haoran/gotest/dockertest/container.go [LSP-Bridge] Process terminated. [LSP-Bridge] Process restarted. [LSP-Bridge] found language server: /Users/haoran/go/bin/gopls [LSP-Bridge] Active project ’dockertest’, enjoy hacking! Mark set [2 times] Saving file /Users/haoran/lsp.log... Wrote /Users/haoran/lsp.log previous-line: Beginning of buffer (No changes need to be saved)
我分析了一下日志, 没有啥问题, 目前还不知道为什么要等待那么长时间。
from lsp-bridge.
你尝试把 lspbridge/langserver/gopls.json 文件改成下面的内容, 再看看能否补全? 我怀疑 handle_workspace_configuration_request 函数返回了 gopls 不喜欢的参数, 然后 gopls 就不再补全了, 今天我在开发 workDoneProgress 协议的时候发现 gopls 这个特性。
{
"name": "gopls",
"languageId": "go",
"command": [
"gopls",
"-remote=auto"
],
"settings": {}
}
from lsp-bridge.
更新到最新 commit,没有成功
❯ cat langserver/gopls.json
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: langserver/gopls.json
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ {
2 │ "name": "gopls",
3 │ "languageId": "go",
4 │ "command": [
5 │ "gopls",
6 │ "-remote=auto"
7 │ ],
8 ~ │ "settings": {}
9 │ }
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
from lsp-bridge.
你改成
{
"name": "gopls",
"languageId": "go",
"command": [
"gopls",
"-rpc.trace",
"--debug=localhost:6060",
"-remote=auto"
],
"settings": {}
}
试一下, gopls 启动后, 浏览器访问 localhost:6060 , 看看有没有什么信息, 我怀疑什么地方配置错了, 导致 gopls 无法补全
from lsp-bridge.
这个页面,还有 6060 的其它页面,没什么变化。在可补全的项目下,和不可补全的项目下一样。
之前这个项目是可以补全的,现在改了之后,变这样了。
from lsp-bridge.
好吧, 感谢你的测试, 只能看哪天有灵感才能修复了。
from lsp-bridge.
eglot
能帮我发送一下 eglot 和 LSP Server 通信的日志吗? 我检查一下是否 lsp-bridge 遗漏了某些配置? 谢谢
from lsp-bridge.
是的,代码越多、需要的库越多,等待的时间越长。 几分钟、十几分钟、二十几分钟... 之后能一直正常使用。
*lsp-bridge*
: lsp.log[yas] Prepared just-in-time loading of snippets (but no snippets found). Waiting for git... [2 times] For information about GNU Emacs and the GNU system, type C-h C-a. [2 times] Making completion list... [LSP-Bridge] found language server: /Users/haoran/go/bin/gopls [LSP-Bridge] Active project ’dockertest’, enjoy hacking! Mark set [2 times] Mark activated Mark set [2 times] Saving file /Users/haoran/gotest/dockertest/container.go... Wrote /Users/haoran/gotest/dockertest/container.go [LSP-Bridge] Process terminated. [LSP-Bridge] Process restarted. [LSP-Bridge] found language server: /Users/haoran/go/bin/gopls [LSP-Bridge] Active project ’dockertest’, enjoy hacking! Mark set [2 times] Saving file /Users/haoran/lsp.log... Wrote /Users/haoran/lsp.log previous-line: Beginning of buffer (No changes need to be saved)
从这个现象看, 更像是 go import 的那些包在下载, 下载完以后就可以补全了。
我看到日志里面是 docker test 的项目, docker 镜像里应该没有go的这些库吧?
from lsp-bridge.
它只是仓库的名字叫dockertest,但是并不是连到docker里面的。
from lsp-bridge.
大伙, 请把上面文件覆盖到 /home/andy/lazycat-emacs/site-lisp/extensions/lspbridge/langserver/gopls.json 这里, 再测试一下看看能否补全?
感谢。
from lsp-bridge.
@manateelazycat 能补全了,但是 1.初始化会等十几秒;2.在 lsp 选项前会闪一次 search words;
from lsp-bridge.
@manateelazycat 能补全了,但是 1.初始化会等十几秒;2.在 lsp 选项前会闪一次 search words;
大佬, gopls.json 的 capabilities 下有很多字段, 能否帮我把下面这些字段一个一个的删除以后重启 lsp-bridge 测试一下?
我想知道在你的环境下, 究竟是 capabilities 下的哪个字段配置错导致你没办法补全的?
工作量有点大, 辛苦大佬了。
from lsp-bridge.
无法复现了,capabilities 全部删除后也是能补全的。回滚到一开始这个 issue 建立时的 commit 也能补全了。
from lsp-bridge.
无法复现了,capabilities 全部删除后也是能补全的。回滚到一开始这个 issue 建立时的 commit 也能补全了。
你的意思是有可能是环境的问题?
from lsp-bridge.
我重新下载建立 issue 时 gopls 的版本 0.15.1,也是可以补全的。因为最近没有使用 emacs,所以不知道是本地哪个环境导致的了。
from lsp-bridge.
你的意思是有可能是环境的问题?
应该是环境的问题
from lsp-bridge.
这个issue的各位同学好, 我调整了默认的LSP配置, 大家再测试看看。
我先关闭这个issue, 如果大家还有问题请重新提交issue, 这个issue比较乱, 中间涉及版本差别比较大, 新的issue比较好追踪问题。
from lsp-bridge.
Related Issues (20)
- 使用lsp-bridge-semantic-tokens-global-scope-face后,C++中的宏和函数的颜色无法区分开 HOT 9
- Rust中函数名不显示 HOT 1
- C++自己写的头文件函数名不显示,标准库可以 HOT 6
- Incorrect response to `window/workDoneProgress/create` HOT 2
- paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted HOT 3
- 补全自动修改窗口位置 HOT 3
- `lsp-bridge` clogging `org-babel-tangle` when enabled HOT 2
- Dynamically set up `lsp-bridge-get-single-lang-server-by-project` HOT 3
- rust remote server 失败,可能是在远程主机没有启动 tabnine HOT 7
- react jsx 中不支持 tailwindcss HOT 3
- semantic-tokens 渲染modifiers时能否支持combine和override混用 HOT 7
- 调用 multi-server-function的时候,如果当前project 没有git init,则会报错,建议设置当前目录作为缺省值并且打印message提醒一下用户 HOT 1
- `lsp-bridge-find-def` with `pyright` takes to stub file (`.pyi`) instead of code (`.py`). HOT 1
- When I open the vue project, ts doesn't recognize my directory HOT 5
- vue模式下跳转定义文件,第二次就失败了 HOT 4
- Document how to use lsp-bridge with python installed via pyenv HOT 1
- An error occurred when I use lap-bridge to edit a file remotely HOT 4
- 使用最新代码(commitid: 1f47c8fb),js 无法补全 HOT 1
- 刚装上,同时出现了 YASnippet 和 lsp 的补全列表,怎么去选中 YASnippet 的候选项了 HOT 2
- Probably a typo in multiserver/qmlls_javascript.json HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsp-bridge.