GithubHelp home page GithubHelp logo

Comments (6)

dimbleby avatar dimbleby commented on July 30, 2024

I've just spotted that the unwanted trailing line was introduced at d6a76b3 to fix #131, so perhaps it's not so straighforward.

from nvim-lint.

mfussenegger avatar mfussenegger commented on July 30, 2024

Can you try with #145?

from nvim-lint.

dimbleby avatar dimbleby commented on July 30, 2024

This works fine for me - but isn't it what we had before 7fb6ae1? Will this reopen #127?

from nvim-lint.

dimbleby avatar dimbleby commented on July 30, 2024

Maybe something like this:

diff --git a/lua/lint.lua b/lua/lint.lua
index fee3ac7..4918463 100644
--- a/lua/lint.lua
+++ b/lua/lint.lua
@@ -165,10 +165,8 @@ function M.lint(linter)
   start_read(linter.stream, stdout, stderr, bufnr, parser, ns)
   if linter.stdin then
     local lines = vim.api.nvim_buf_get_lines(0, 0, -1, true)
-    for _, line in ipairs(lines) do
-      stdin:write(line .. '\n')
-    end
-    stdin:write('\n', function()
+    local content = table.concat(lines, '\n')
+    stdin:write(content .. '\n', function()
       stdin:shutdown(function()
         stdin:close()
       end)

I couldn't find a way of getting the actual content of the buffer rather than this line-by-line reconstruction, which seems to me unsatisfactory - eg what if the linter wants to warn you that you have mixed line endings? But perhaps this will do.

from nvim-lint.

mfussenegger avatar mfussenegger commented on July 30, 2024

This works fine for me - but isn't it what we had before 7fb6ae1? Will this reopen #127?

It's similar yes, but with the new PR the shutdown also uses the callback before invoking close.

Maybe something like this:

This also sends a trailing \n ? Not sure why it would be better than the status quo?

from nvim-lint.

dimbleby avatar dimbleby commented on July 30, 2024

my version sent only a single trailing newline - which should be present in every posix-compliant file.

However if I'd misread your proposal and it's not going to re-break #127, it's all good - thanks!

from nvim-lint.

Related Issues (20)

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.