badetitou / Pharo-LanguageServer

A Language Server Protocol implementation in Pharo
GNU General Public License v3.0
30 stars 6 forks source link

Changes for jupyter debugger support and adds breakpoints #3

Closed jmari closed 3 years ago

jmari commented 3 years ago

It's working on Jupyterlab, but I didn't test it in VSCode (i'm overflooded...). there are several additions and just little changes in the compile+evaluate process that I need to compile in my own context.

badetitou commented 3 years ago

Hi, it looks like the method fileNameForCode: of the DAPServer is missing in this PR. Can you add it to the PR?

(thanks for the contribution - I'll integrate it as soon as it works with VSCode too)

jmari commented 3 years ago

copy from discord conversation...

Ok I'll check it this should not be called from your package...it's an extension by iPharo. It's a mistake sorry.

It's not easy to solve it....jupyter doesn't use dapLaunch ... When it sets the breakpoints using dapSetBreakpoint, it passed a Murmur2 hash as source path, so I store the breakpoint list in a dictionary with the hash as key . When it executes the code I have to calculate the Murmur2 hash from the source code so I can get back the breakpoint list... I think you can try to set breakpoints and see what Vscode sends you...and change the (self filenameForCode) in dapLaunch by other call that returns what you need Basically it should be the filename I think But jupyter is not file oriented so it creates a fictitious name using the Murmur2 hash

badetitou commented 3 years ago

I added log and check such as

myVar at: 0 ifPresent: [ "dosomething only if present" ]

Is it still of for you @jmari ?

jmari commented 3 years ago

I'm not sure what you are talking about...what do you mean with

myVar at: 0 ifPresent: [ "dosomething only if present" ]
badetitou commented 3 years ago

I modified the access to sourcesReferenceCache to be more error resilient

https://github.com/badetitou/Pharo-LanguageServer/commit/ef3b67503202048eca7bc775178b5ef8dbd4a17f#diff-c70ef176bca7a9e67dee1e5127afbf66395db070ed6d34e1567fe82eaef2d772R361-R364

badetitou commented 3 years ago

Ok, it looks perfect to me We still cannot add breakpoint in VSCode, but I will be able to do it thanks to your contribution

Thanks a lot