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

feat: add swipl #1600

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: add swipl #1600

wants to merge 3 commits into from

Conversation

tani
Copy link

@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
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
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