Skip to content
This repository was archived by the owner on Aug 12, 2023. It is now read-only.

feat: add swipl#1600

Open
tani wants to merge 3 commits intojose-elias-alvarez:mainfrom
tani:main
Open

feat: add swipl#1600
tani wants to merge 3 commits intojose-elias-alvarez:mainfrom
tani:main

Conversation

@tani
Copy link
Copy Markdown

@tani tani commented Jun 23, 2023

swipl

SWI-Prolog is a versatile implementation of the Prolog language.

Usage

local sources = { null_ls.builtins.diagnostics.swipl }

Defaults

  • Filetypes: { "prolog" }
  • Method: diagnostics
  • Command: swipl
  • Args: { "-q", "-t", "halt(1)", "-s", "$FILENAME" }

Copy link
Copy Markdown
Owner

@jose-elias-alvarez jose-elias-alvarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, but based on what I'm seeing, you are basically iterating over each line and matching against patterns, right? If so you may want to consider using the diagnostics.from_patterns helper, which could simplify your code a bunch and make future maintenance easier.

end,
on_output = function(params, done)
local diagnostics = {}
local lines = vim.fn.split(params.err, "\r\n\\|\r\\|\n")
Copy link
Copy Markdown
Owner

@jose-elias-alvarez jose-elias-alvarez Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small improvement: we could consider using vim.split here instead, which would simplify your check for emptiness a few lines down.

Edit: also, if you used the helper I mentioned, this would be handled automatically.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants