8
lorentz
320d

I spent hours trying to support \n, \r and \r\n in my algorithms to convert between utf16 line/col and utf8 absolute indices to comply with the LSP, before realizing that

- Orchid itself doesn't support \r
- There is no established user base

so I'm in the best position to reject all files that contain \r and offer to convert them instead.

Comments
  • 0
    What are you building?
  • 1
    @ScriptCoded A language server that colors tokens in Orchid source code based on where they end up after macros, and possibly provides a GUI for stepping through macro rules.
  • 0
    @lorentz why not simply ignore \r?
  • 2
    @ScriptCoded Actually, I don't see your name often under my rants so you might not know what Orchid is. It's a language I've been building for about two years now.

    https://github.com/lbfalvy/orchid

    Actually, I should write a better introduction in the readme, the current one is missing some of the coolest features because I wasn't sure I could build them when I wrote it.
  • 1
    @Lensflare LSP communicates positions in pairs of 0-based line/column numbers, where line breaks are "\n", "\r" and "\r\n", and columns are counted in utf-16 code points.

    If I try to use a position without correctly handling all 3 line breaks, things break.
  • 0
    @lorentz can‘t you remove all \r before passing the content to LSP?

    EDIT: I just realized that it would mess up the positions when you get your results from LSP back into the code.
  • 3
    @lorentz Ah cool, thanks for the explanation! That does ring a loud bell but I mostly lurk here now as an old habit since, well, the platform's kinda derailed...
  • 0
    "\r" is used by OSX, right? Did they drop that and not the weird ' and " and & symbol formatting that breaks rendering for non-Mac users?
  • 1
    @Parzi I'm not sure but according to the internet Mac OS since OSX uses \n
  • 0
    @lorentz everyone and everything uses \n. Except for Microsoft, of course.
Add Comment