Git Product home page Git Product logo

Comments (7)

jdaridis avatar jdaridis commented on May 25, 2024 1

Unfortunately, the editor squiggles indicating errors/warnings are tightly integrated with the original grammar/parser. When there is a parse error the server notifies the client about it. To send the error notification I need the file, line and column start and end, which I get from the parser.

I will try, though, to see what can be changed/added in order to integrate the linter, but I can't promise it is gonna play nicely

from souffle-lsp-plugin.

langston-barrett avatar langston-barrett commented on May 25, 2024 1

I've added support for JSON output to souffle-lint.
The output looks like this:

{
  "fragments": [
    {
      "node_text": "SrcVal bshr Imm",
      "start": {
        "row": 5673,
        "column": 26
      },
      "end": {
        "row": 5673,
        "column": 41
      },
      "context": {
        "node_text": "Val = SrcVal bshr Imm",
        "start": {
          "row": 5673,
          "column": 20
        },
        "end": {
          "row": 5673,
          "column": 41
        },
        "context": null
      }
    }
  ],
  "rule": {
    "name": "style-symb-op",
    "short": "Prefer symbolic operators",
    "long": null,
    "captures": false,
    "slow": false,
    "queries": [ ... ],
    "examples": [
      {
        "before": "rule(x band y) :- rule(x), rule(y).\n",
        "after": "rule(x & y) :- rule(x), rule(y).\n"
      },
      {
        "before": "rule(lnot y) :- rule(y).\n",
        "after": "rule(!y) :- rule(y).\n"
      }
    ]
  },
  "source": "",
  "source_file": "bench/ddisasm.dl"
}

The "fragments" are the bits of the source file that the rule finds to be problematic. These come with "context", which are their parents in the syntax tree. The "rule" is the "lint". It comes with examples and a bit of metadata.

I'll create a new release soon with this feature.

from souffle-lsp-plugin.

langston-barrett avatar langston-barrett commented on May 25, 2024 1

v0.4.0 of souffle-lint has support for JSON output. Try it out with:

souffle-lint lint --format json prog.dl

from souffle-lsp-plugin.

langston-barrett avatar langston-barrett commented on May 25, 2024 1

@jdaridis That looks great!! :-) Thanks for collaborating with me on this.

from souffle-lsp-plugin.

jdaridis avatar jdaridis commented on May 25, 2024

@langston-barrett I think I found a way to implement it. My idea is to have a code action (the lightbulb which appears to give code action suggestions) and to always have an option "Lint with souffle-lint" and to then run souffle-lint. The only problem is how to grab the output. One suggestion would be to output JSON or another format for the errors to the standard output and then my server can intercept it and do its thing in the editor.

UPDATE: I think that a source action on right-click would be more suitable to trigger linting. The problem now is an easier to parse output format in the standard output and I think we are ready.

from souffle-lsp-plugin.

jdaridis avatar jdaridis commented on May 25, 2024

Added integration with souffle-lint with source code action.
souffle-lint
Screenshot from 2022-11-13 18-24-29

from souffle-lsp-plugin.

jdaridis avatar jdaridis commented on May 25, 2024

My pleasure. I think this addition unlocks a lot of possibilities

from souffle-lsp-plugin.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.