10

2018-09-09

 3 years ago
source link: http://maskray.me/blog/2018-09-09-ccls-update
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

2018-09-09 ccls最近更新

加了一些initialization options,参见https://github.com/MaskRay/ccls/tree/master/src/config.h

  • cacheDirectory: ""

默认值为.ccls-cache,索引时会在项目目录下创建.ccls-cache目录放置cache文件,再次打开时无需重新索引。现在这个选项可以指定为空字串,使索引文件放在内存中。

这个索引不要和ccls另外的全局索引混淆了。全局索引始终在内存中。打开项目读入索引文件时,会把索引文件合并到全局索引。当一个文档修改时,需要把全局索引中数据改文档的部分删除,插入新的,因此每个文档留有一份记录。

  • clang.excludeArgs: ["-fopenmp"]

可以用于排除仅GCC支持的选项、让clang产生不想要的diagnostics的选项、产生索引问题的选项等。

  • diagnostics.onChange diagnostics.onSave

默认diagnostics.onChange: truediagnostics.onSavediagnostics.onSave为false,代表文档编辑时触发diagnostics,保存时则不会。 编辑时会用clang反复parse,如果担心性能问题,可以设置diagnostics.onChange: false

  • index.onChange: true

默认为false,设置为true可以即时索引,注意把cacheDirectory设为空字串防止反复读写文件。

{
"cacheDirectory": "",
"index": {"onChange": true}
}
  • $ccls/navigate可以用于namespace

之前无法知道namespace foo {}}的位置,现在非definition的declaration表示为:

struct Reference {
Range range;
Usr usr;
SymbolKind kind;
Role role;
};
struct Use : Reference {
int file_id = -1;
};
struct DeclRef : Use {
Range extent; // 能表示namespace foo {}整个范围
};

参见wiki中Emacs和LanguageClient-neovim页面介绍。

另外之前textDocument/hover作用在namespace foo上不显示名字,现在显示了。

  • indexer改进

conversion function operator int的整个作为spelling range,之前只有operator部分是。textDocument/documentHighlight显示不好看。

destructor ~foo整体作为spelling range了,之前只有~部分。

C中常用的typedef struct {} foo;写法,原来anonymous struct没有名字,现在表示为anon struct foo(name for linkage purposes)。

indexer也能复用completion和diagnostics的preamble,加速索引。

修复了一个out-of-bands修改源文件,载入索引文件可能导致初始错误引用计数symbol2refcnt修改的bug。pipeline的multiversion concurrency control真的超级粗糙,需要人来研究下……

Share Comments


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK