-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IHaskell support #313
Comments
We had a similar issue with Scala kernel if I remember correctly and the problem was on the Scala side (i.e. the kernel was not returning mime type correctly)... |
Whoops, it was Robot kernel, not Scala. See robots-from-jupyter/robotkernel#40. |
The actual mime-type is derived from the kernel language info and fallbacks to cell metadata if none, see: For file editor, the mime-type provided by the JupyterLab mime-type registry should be used: |
By the way, thank you for reporting it! Please give us an update on how it is going, and please feel welcome to contribute your spec. |
Oh yeah thanks @krassowski , it looks like you're right, the IHaskell kernel is not reporting https://jupyter-client.readthedocs.io/en/stable/messaging.html#kernel-info |
On our side, we could also try and back it out of So, in the meantime, we've probably done a Good Thing in highlighting this on multiple kernels, as it's a really good piece of standards-compliant(ish) metadata... but given it's come up twice, we should probably be more inclusive. |
And, i'll echo @krassowski 's thanks in posting this! Near term: if you get it working, we would love to get your recipe added to the docs, or link out to a gist, etc. Longer term: official support for haskell would be great! Our gates for inclusion thus far has been something like (roughly in order):
This does the most for the "Greater Good," even though it would end up requiring maintenance, as it would help keep us honest moving forward for features important to you so that the next person doesn't have to struggle up the same learning curve... or just quit! |
I patched the Now my next problem is that I have anther runtime null execption because the Is my Language Server User Preferences in the first post of this issue not properly registering with the |
It just occurred to me that you appear to set the specs in the wrong place; The use of Please see Configuring. You basically need to create a python spec file as seen here: https://github.com/krassowski/jupyterlab-lsp/tree/master/py_src/jupyter_lsp/specs (for example @bollwyvl would JSON-based specs still work? I think we do not use any in the repo. |
Yes, the JSON specs still work, have used them for some test implementations... here's the mimimum one I did for testing out LanguageServer.jl: {
"LanguageServerManager": {
"language_servers": {
"julia-languageserver": {
"version": 3,
"argv": ["julia", "--debug=yes", "--project=.", "-e", "using LanguageServer, LanguageServer.SymbolServer; runserver()", "."],
"languages": ["julia"],
"display_name": "LanguageServer.jl",
"mime_types": ["text/julia", "text/x-julia"]
}
}
}
}
The quick test of this is putting it in For packaging, etc. this can be put into: $CONFIG/jupyter_notebook_config.d/languageserverjl.json where jupyter --paths --json |
Thanks for the advice guys. I'm currently trying this:
|
Thanks for keeping with it! For simplicty:
Some potential gotchas embedded in that:
|
Okay my configuration is working as |
As you guessed @bollwyvl , |
Well, it seems that it works in the notebook too, however, the language server reads it as if it was a file (as expected - this it is how the LSP for notebooks work - there is no concept of a cell nor of a notebook in the LSP - the cells are merged together and the server is given a flat file, which we call "virtual document"), thus requires an entrypoint (I based my Hasklell knowledge on this answer). We workaround kernel-specific additions to the syntax that deviate from valid files using regular expressions to modify the resulting "virtual document" (see positioning system illustration which demonstrates that we can split a single notebook into multiple virtual documents, and replace the Python-kernel specific %% magics with valid code for each language). Thes replacements are defined in magics module. I imagine that maybe it would help if we could prepend each virtual document with |
Yeah, I see what you're saying @krassowski . What you're describing wouldn't work. I can't think of a simple transformation from code cells to virtual document that would work. There are nine different kinds of things which can be in an IHaskell code cell: It will be tricky to make this work. |
What kind of transformation would need to be done to support IHaskell then? Btw we could also treat each cell as an independent virtual document. Or, is there any working LSP IHaskell integration for notebook out there? |
I tucked my configuration into the branch https://github.com/jamesdbrock/ihaskell-notebook/tree/lsp while we give this a think. |
Thanks @krassowski and @bollwyvl , This is a really nice JupyterLab extension, I hope we can get it working for IHaskell. |
I'm trying to use the ghcide LSP server for Haskell with this extension, with these Language Server User Preferences:
After the message
LSP: Untitled1.ipynb ready for connection
, an error is thrown from this line:https://github.com/krassowski/jupyterlab-lsp/blob/f305ab4e1d8ff6b62daffe1460636175406a00df/packages/jupyterlab-lsp/src/adapters/jupyterlab/jl_adapter.ts#L212
this
is of typeNotebookAdapter
, andthis.mime_type
isundefined
, and the error says:The text was updated successfully, but these errors were encountered: