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

add mh_lint#1216

Open
ayoubelmhamdi wants to merge 1 commit intojose-elias-alvarez:mainfrom
ayoub-fork:mh_lint
Open

add mh_lint#1216
ayoubelmhamdi wants to merge 1 commit intojose-elias-alvarez:mainfrom
ayoub-fork:mh_lint

Conversation

@ayoubelmhamdi
Copy link
Copy Markdown
Contributor

Matlab linter form miss_hit can work with Octave too

This PR use the output from mh_lint, but can do better if we use json that officially supported by mh_lint

@jose-elias-alvarez
Copy link
Copy Markdown
Owner

This looks good to me, is there anything you wanted me to check before merging it?

@ayoubelmhamdi
Copy link
Copy Markdown
Contributor Author

if mh_lint is not merged, how i can use it, from dotfiles?

I'm trying this config but something is not correcte

local null_ls = require 'null-ls'
local helpers = require 'null-ls.helpers'

local mh_lint = {
  method = null_ls.methods.DIAGNOSTICS,
  filetypes = { 'matlab', 'octave' },
  generator = null_ls.generator ({
    command = 'mh_lint',
    args = { '--brief', '$FILENAME' },
    to_stdin = false,
    from_stderr = true,
    format = 'line',
    on_output = helpers.diagnostics.from_pattern ({
      {
        pattern = [[(%d+):(%d+): (%w+): (.*)]],
        groups = { "row", "col", "severity", "message" },
      },
    }),
  }),
}

null_ls.register(mh_lint)

null_ls.setup {
  sources = {
    null_ls.builtins.diagnostics.mh_lint,
  },
}

log

[TRACE Sat 05 Nov 2022 05:04:26 AM CET] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:123: received LSP request for method shutdown
[TRACE Sat 05 Nov 2022 05:04:26 AM CET] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:148: received LSP notification for method exit
[WARN  Sat 05 Nov 2022 05:04:29 AM CET] ...ck/packer/opt/null-ls.nvim/lua/null-ls/builtins/init.lua:17: failed to load builtin mh_lint for method diagnostics; please check your config
[WARN  Sat 05 Nov 2022 05:04:30 AM CET] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:92: failed to run generator: ...ker/opt/null-ls.nvim/lua/null-ls/helpers/diagnostics.lua:100: bad argument #1 to 'match' (string expected, got table)

@jose-elias-alvarez
Copy link
Copy Markdown
Owner

Yes, you can test it out from your config or from a local branch. Your specific error comes from a mismatched signature for from_pattern - see the source for the correct usage.

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