9 pointsby teo_zeroa year ago5 comments
  • card_zeroa year 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_zeroa year 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).

      • wruzaa year 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.

  • dchesta year ago
    Most editors that support language servers (https://langserver.org/) can do this. They use "real compiler's" lexer/parser for this.
  • solardeva year 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-cheneya year ago
    Sounds like a job for custom lint rules.
  • viraptora year ago
    Python lsp in vscode does it. Other lsp-s probably too.