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

Command output is always split on \n, regardless of actual line ending #555

Closed
jose-elias-alvarez opened this issue Jan 6, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@jose-elias-alvarez
Copy link
Owner

#550 revealed that null-ls was using the buffer's fileformat to determine the command's line ending, which isn't a valid assumption. Commands may use input / environment to determine the "correct" line ending, but it's not something we can rely on.

For now, 9265a99 hardcodes \n as the output line ending. We could theoretically hardcode this at the source level, but that's brittle and would require cross-platform testing to determine command behavior.

The best solution I can think of is to determine the correct line ending from the output itself. neovim/neovim#16286 provides an example of how we might do this (I wouldn't want to rely on the internal utility if / when the PR is merged).

@jose-elias-alvarez jose-elias-alvarez added the bug Something isn't working label Jan 6, 2022
@mjlbach
Copy link

mjlbach commented Jan 15, 2022

I've found that (at least in the LSP case), servers can send a mix of \n, \r and \r\n. It's simpler just to sanitize \r\n to \n and then split on \n than to bother trying to detect the line ending.

@jose-elias-alvarez
Copy link
Owner Author

I've found that (at least in the LSP case), servers can send a mix of \n, \r and \r\n. It's simpler just to sanitize \r\n to \n and then split on \n than to bother trying to detect the line ending.

Good idea – I think a solution like the one you used for apply_text_edits() makes sense here, too.

@jose-elias-alvarez
Copy link
Owner Author

Closed by 069f60f.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants