clangd trying to get preamble for non-added document

这个错误是写C++的时候发现的,查了下资料,然而完全看不懂 :yum:

这玩意写了一会就出来了,然后不全用不了,得重启emacs才行,好烦啊

我也遇到了,每次都是手动 lsp-bridge-restart-process,而且好频繁

但是我会遇到 lsp-bridge-restart-process 重启也没用的时候 请问这是 clangd 的错误还是 lsp 的错误

更新最新版, 把 lsp-bridge-enable-signature-help 这个选项关闭以后再看看?

我感觉 clangd 不支持 signature help 呀。

https://github.com/clangd/clangd/issues/609

稍等,我写代码的时候看看

https://clangd.llvm.org/features#signature-help

官网显示很早就支持了

你的意思是

This is definitely a client bug, not something clangd can do anything about

??

The editor tells clangd which files are open/closed, and clangd only supports operating on files that are open. That error message is what you get if the file has not been opened, or has been opened and then closed[1].

这里说打开关闭文件的时候需要发送open/close events给clangd

如果没做这个会有问题

还是会出现这个错误,啊啊啊啊啊啊!

给我个最小的可重现文档,一定要包括详细的重现步骤, 怎么写代码会出问题。

不要着急。

他是写着写着就出问题了,你也可以做到的
哈哈哈哈哈哈哈
你稍微把项目弄复杂点,就会看到了

如果你都不愿意反馈一下重现环境的话, 我估计很难帮到你。

那你等一下,我去折腾一会

试试这个,新建一个hello.hpp 文件,手抄

#pragma once
#include <string>
using std::string;

class Student {
private:
  int age;
  string name;

public:
  Student(int age, const char * name);
  Student(int age, const char & name);
  ~Student();

public:
  int getAge();
  string & getName();
  
};

再新建一个 hello.cc 文件,

#include "hello.hpp"

查看 include 之后是否发生这个错误

我到时候没有遇到你这个错误, 遇到了别的错误。

这还有救吗,我要不再试试?

你更新到最新版再试一下, 我这边没有重现你说的问题。

我去提个issue吧,顺便把我的操作录屏

先更新最新版, 还是能重现, 把详细重现的步骤发一下。