emacs 29的tree-sitter好用吗?

28 没有内置的 tree-sitter 吧

doom已经配置好了,我也不知道怎么弄的

Doom 在 Emacs 28 的时候配置的是 elisp-tree-sitter。 Emacs 29 开始才内置支持 tree-sitter,内置的叫 treesit

c-modec-ts-mode 对比图 .感觉差距不是很大.

output-2023-01-13-12:36:36

1 个赞

内存占用怎么样?

是个挺大的优势, 记得以前c+±mode偶尔遇到大的c++文件, 编辑卡成幻灯片

代码书写错误的提醒效果怎么样?

这个问题有点印象, 是不是简单的宏没问题? 复杂的才有问题?

这个应该能配置, tree-sitter这种方案应该是大趋势

看上去treesitter更准确, 比如下面的pid变量也识别了,

但是printf里面的pid变量没识别…

python-ts-mode 是怎么产生的?

是的 不过不是很在意语法高亮 (因为有symbol-overlay).主要是切换时会有卡顿. 所以暂时都是不打开 c-ts-mode.

2 个赞

Emacs 29 以上编译时支持 tree-sitter 的话就内置了啊。

这个感受 不明显,我是用的lsp和flycheck

tree-sitter 现在是没法和 eglot 配合使用么?

当我打开cpp文件,切换到 c++-ts-mode, 发现eglot 没有启用,使用M-x eglot 显式启用eglot, 发现eglot会报错:

[eglot] Sorry, couldn't guess for `c++-ts-mode`

eglot 版本太低了吧,新版本的 eglot-server-programs 都是包含 *-ts-mode

1 个赞

Centaur Emacs 已经默认支持tree-sitter了。 前置条件是使用的Emacs支持tree-sitter特性。见:centaur-tree-sitter

1 个赞

感谢哈 :grinning: :grinning: :grinning: :grinning:

eglot 需要根据 major mode 打开对应的 lsp server,c+±mode 改成 c+±ts-mode 了,不认识,得配置一下 eglot 的 major mode 也 lsp server 的关系

我直接把 elpa/eglot 删除掉,直接使用 emacs-29 内置的eglot 就好.