pico8-ls icon indicating copy to clipboard operation
pico8-ls copied to clipboard

Symbols update

Open mika76 opened this issue 2 years ago • 7 comments

mika76 avatar Dec 04 '22 10:12 mika76

Just created a draft pull request here to track changes and see if it's heading in the direction that you like @japhib I still have more changes for the lua comment doc, but am just having some issues because I made comments tokens and now parsing breaks in a couple of places...

mika76 avatar Dec 04 '22 10:12 mika76

Oh and I don't think the compile/bundling will work yet since I changed the compile file from main.js to extension.js (basically I put everything back to the basic tutorial for lsp server and then worked from there to make it debuggable)

mika76 avatar Dec 04 '22 10:12 mika76

PPS 🤣 I did all these changes in a jumble then tried to selectively stage and commit - I think I got all the ones needed for these specific changes but be aware I might have missed something.

mika76 avatar Dec 04 '22 11:12 mika76

Seems like there's a bunch of stuff missing though. I don't see anything related to ldoc, for example, or anything in server.ts which would translate the new symbol types.

japhib avatar Dec 06 '22 18:12 japhib

Seems like there's a bunch of stuff missing though. I don't see anything related to ldoc, for example, or anything in server.ts which would translate the new symbol types.

I'm still trying to resolve the comment parsing - I made comments a proper Token, but then that kinda screwed up some of the Statement, Table and Function parsing so it was showing errors (it was not expecting extra comment tokens) - but this is also the part that is reading in and parsing the descriptions for the ldoc.

I've just hit a bit of a busy patch at work and haven't had a chance to clean it all up - I will get back to it in a couple of days hopefully...

mika76 avatar Dec 06 '22 19:12 mika76

Looking at https://www.lua.org/manual/5.4/manual.html#3.1 I can see that even the spec says comments are mostly ignored, so I'm going to rewrite the comment part a little because I don't like the direction it took. Making it a token makes it really difficult to ignore, I have to basically put in code all over the place to make sure comments are skipped.

mika76 avatar Dec 08 '22 12:12 mika76

So got a bit further now - I had to do a bit of rewriting because I didn't like how I did it before.

  1. Originally short comments were being stored separated by line breaks, so I had to build in a way to group them together into a comment block.
  2. I had to propagate the comments through the lexer to the parser and symbols visitor somehow - currently a DocComment is only being attached to a function keyword but I think it should be connected to a table as well (there is no one definition for luadoc and annotations, plus this is for pico-8 so I don't think I'm going to make it very advanced and try and keep it simple)
  3. I had to also create a way to find the scope of the symbol being queried (I've only changed the OnHover for the moment) but I think I managed - still lots of testing to be done.
  4. Only rudimentary display of the markdown for the moment - this needs to be cleaned up and formatted nicely

Still it's been fun and I'm getting there 😊

Any comments or suggestions welcome.

mika76 avatar Dec 15 '22 07:12 mika76

Closing due to inactivity and merge conflicts.

japhib avatar Jul 12 '24 22:07 japhib