Skip to content

Comment on Enhanced document symbol menu for Zig

Comments

Hello, I've been playing with Zig the last couple of months. The navigation between document symbols in Neovim is a bit complicated the document has symbols with the same name. I improved it adding the path to every symbol. For example you have two structures:

    const App = struct {
        fn init() @This() { return .{} }
    };

    const Connection = struct {
        fn init() @This() { return .{} }
    };
You get the following items in the navigation list:
    App::init
    Connection::init
Essentially, it's a configuration of Telescope and Nvim-Treesitter. You can take the file from here https://laladrik.xyz/zig_document_symbols.lua. However, if you curious about the process of creating a custom Telescope menu and inspection of the source code with Tree-sitter, checkout the entire article.

Also, while I working on it, I found that LuaJIT 2.1 compares strings as fast as integers. Eventually, I did a little research about it and published the results here https://laladrik.xyz/blog/luaStringComparison/

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.