Open 0xdevalias opened 7 months ago
SublimeText plugins are Python based, so i'm not sure how hard it would be to integrate
bitdowntoc
in that regard (without just shelling out to a binary/etc)
Seems there is some background interest in cross-compiling Kotlin to Python, but not sure if it's gotten to a usable state over the years:
Sounds like maybe it's still in the 'developing'/'experimental idea' stage; so probably not usable for this yet unfortunately:
These are very interesting resources and ideas. Thank you for this!
However, porting it to VS Code first would maybe make more sense, as I believe it is now more popular than Sublime Text? Wondering also if those editors do (or will) support Web Assembly. This would make the porting way easier (and would be quite cool to implement).
porting it to VS Code first would maybe make more sense, as I believe it is now more popular than Sublime Text?
@derlin From a raw usage/popularity standpoint, that is probably true. Though personally I don't find myself using VS Code much. I like the 'fast/lightweight' aspect of SublimeText as my 'text editor', whereas when I reach for a more 'heavy weight' IDE, I tend to use JetBrains products rather than VS Code; particularly as they tend to be more 'batteries included'.
It looks like VS Code extensions are nodeJS based:
One of the reasons I was thinking that it might be quicker to do the SublimeText plugin is that you could (theoretically) fork the existing one, and just edit that to integrate with bitdowntoc
's semantics.
From a quick skim, it seems it only implements 2 main commands (insert
and update
):
Which both seem to basically share the one implementation (update
just calls insert
):
Given most of the logic of insert
is probably already self-contained within bitdowntoc
itself, the implementation there would probably be fairly straightforward.
The last bit seems to be the autorunner
, which just seems to be a small bit of code that defines what sorts of files/when to execute the update
command automagically:
Wondering also if those editors do (or will) support Web Assembly.
@derlin That's not something I've looked into before, but from a quick google:
Support more than Python for package API
A WebAssembly runtime powered by Wasmtime
Using WebAssembly with Python
The cross-language framework for building with WebAssembly
Run WebAssemblies in VS Code for the Web
A WASI implementation that uses VS Code's extension host as the implementing API
How we built a VS Code extension with Rust, WebAssembly, and TypeScript
Another alternative could be to just shell out to the existing bitdowntoc
binary from the main plugin code.
@0xdevalias If this is a CLI tool, then there is no reason it can't be called from python to operate on the ST buffer and provide the TOC you desire. What is the expected flow? You launch command palette and select generate TOC
?
If this is a CLI tool, then there is no reason it can't be called from python to operate on the ST buffer and provide the TOC you desire.
@TerminalFi Yup, that's what I said above:
Another alternative could be to just shell out to the existing
bitdowntoc
binary from the main plugin code.Originally posted by @0xdevalias in https://github.com/derlin/bitdowntoc/issues/35#issuecomment-2095037059
What is the expected flow? You launch command palette and select
generate TOC
?
@TerminalFi If you were aiming to match the existing functionality of the referenced extension, there is the menu/command based aspect, and the 'autorunner' 'on save' aspect; also described above:
From a quick skim, it seems it only implements 2 main commands (
insert
andupdate
):
- https://github.com/naokazuterada/MarkdownTOC/blob/master/MarkdownTOC.sublime-commands
- https://github.com/naokazuterada/MarkdownTOC/blob/master/Main.sublime-menu
Which both seem to basically share the one implementation (
update
just callsinsert
):
- https://github.com/naokazuterada/MarkdownTOC/blob/master/markdowntoc/markdowntoc_insert.py
- https://github.com/naokazuterada/MarkdownTOC/blob/master/markdowntoc/markdowntoc_update.py
Given most of the logic of
insert
is probably already self-contained withinbitdowntoc
itself, the implementation there would probably be fairly straightforward.The last bit seems to be the
autorunner
, which just seems to be a small bit of code that defines what sorts of files/when to execute theupdate
command automagically:Originally posted by @0xdevalias in https://github.com/derlin/bitdowntoc/issues/35#issuecomment-2095037059
This one might be a stretch of an ask, but I figured it can't hurt to at least put it out there.
There's a SublimeText plugin called MarkdownTOC that seemed pretty cool, but it suffers from some bugs (including one that you fixed in this project: https://github.com/derlin/bitdowntoc/issues/26 / https://github.com/derlin/bitdowntoc/pull/29) that makes it unusable for some of my workflows. Looking at their repo, there hasn't been any activity for ~3 years, so it seems unlikely that any fixes will land:
So I was wondering if maybe
bitdowntoc
could maybe be wrapped up into a SublimeText plugin.It seems MarkdownTOC is MIT licensed, so at least in theory that could probably be forked and reworked as a basis if needs be:
SublimeText plugins are Python based, so i'm not sure how hard it would be to integrate
bitdowntoc
in that regard (without just shelling out to a binary/etc)Totally understand if this is too out of scope for this project, or would be too much work, but figured I would ask in case :)