-
Notifications
You must be signed in to change notification settings - Fork 74
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
support cm* files #798
support cm* files #798
Conversation
Having a dune file such as
and building your project should also produce A little more info: https://discuss.ocaml.org/t/ocamlc-bytecode-file-vs-dune-bytecode-bc-file/7395 |
Oh cool, thanks for the great explanations 🤗 I just tested it and it seems to work well with these files 👌 What about the other extensions: .cmx, .cmxa, .cma, .cmxs ? Should we support them too? |
If |
Thanks for the review @mnxn 🤗 I should have addressed all your comments :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into TextDocumentContentProvider
as a lighter alternative to using custom documents because custom documents seem quite heavy. According to its doc:
A text document content provider allows to add readonly documents to the editor, such as source from a dll or generated html from md.
Content providers are registered for a uri-scheme. When a uri with that scheme is to be loaded the content provider is asked.
It seems we could use that and avoid using a custom document, which seems a (heavy-weight) overkill for this feature. I also suppose that then we would get file-change watching for free. What do you think?
Here's an example of how to use that API and it seems the right fit for this task: https://github.com/microsoft/vscode-extension-samples/tree/main/contentprovider-sample
Thanks for your review @ulugbekna 🤗 See this comment and the reply below: microsoft/vscode#53121 (comment) |
6bbbdc8
to
3302a08
Compare
src/cm_editor.ml
Outdated
let (_ : Disposable.t) = | ||
WebviewPanel.onDidDispose webviewPanel | ||
~listener:(fun () -> Disposable.dispose disposable) | ||
() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure we'd like to ignore this disposable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I fixed it in 20c9896
I went for using a Stack
since it's a mutable structure. I could also just use a regular List
and mutate it if you prefer.
20c9896
to
2c9ca15
Compare
This PR adds a new custom editor that shows info about
.cm(t, i, ti, o)
and.bc
files. It uses theocamlobjinfo
behind the scene.I didn't test it with
.bc
files because I don't know how to generate these files 😅Question: it looks like
ocamlobjinfo
also supports.cmx
,.cmxa
,.cma
,.cmxs
. Should we also add support for them?Partially implements #505