9 pointsby teo_zero8 days ago5 comments
  • card_zero8 days ago
    Perhaps this: Semantic Highlighting in Neovim

    https://gist.github.com/swarn/fb37d9eefe1bc616c2a7e476c0bc03...

    In the comments there's also a link to a plugin that does a different kind "Where every variable is a different color":

    https://github.com/jaxbot/semantic-highlight.vim

    • teo_zero7 days ago
      As you pointed out, the latter does a very different kind of highlighting.

      The former is truly semantic, but needs an external compiler (via LSP).

      • wruza6 days ago
        I wouldn’t expect someone to replicate a full compiler as an internal editor plugin ever again only to highlight mistakes. Language servers and their support is one of the best things that happened to editors recently. Everyone moved on from ad-hoc plugins. LSP is what you’re looking for, imo. A regular LSP for semantic errors and a linter LSP[-like] for style, bad practice, unused entity, deprecation, etc warnings.

        For requirement 2 and 3 I think VSCode can do that. Some themes tint every possible class of token, so casting will look different from multiplication. Afaik, it definitely differentiates functions, locals, globals and members, while they are all identifiers.

  • dchest8 days ago
    Most editors that support language servers (https://langserver.org/) can do this. They use "real compiler's" lexer/parser for this.
  • solardev7 days ago
    If I understand you right, I think all the Jetbrains IDEs do this. They actually analyze code (not just syntax) and point out various errors in logic, scope, references, parameters, etc.
  • austin-cheney7 days ago
    Sounds like a job for custom lint rules.
  • viraptor8 days ago
    Python lsp in vscode does it. Other lsp-s probably too.