-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add Steel as an optional plugin system #8675
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
Draft
mattwparas
wants to merge
397
commits into
helix-editor:master
Choose a base branch
from
mattwparas:steel-event-system
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+16,700
−461
Draft
Changes from 89 commits
Commits
Show all changes
397 commits
Select commit
Hold shift + click to select a range
a9d5557
merge from master
mattwparas 28383ea
Optionally load init.scm and helix.scm from env var
RatCornu 90488cb
start working on language configuration
mattwparas 7294983
use selection did change
mattwparas 374389e
adding hooks
mattwparas 9c11585
upgrade steel
mattwparas d17dd31
merge from master
mattwparas d00294c
fix arg parsing
mattwparas cfb7a58
merge latest changes in
mattwparas 21f7a7b
Merge pull request #18 from mattwparas/language-configuration
mattwparas f407a04
cleanup
mattwparas fffa86e
merge from master
mattwparas 14316ae
Merge pull request #19 from mattwparas/language-configuration
mattwparas 2d16a86
update steel submodule
mattwparas 60c0882
remove old document open/close events
mattwparas 7143dd4
use new mutex guard
mattwparas 05f4352
bump steel
mattwparas c9b5276
unpark the interrupt handler after resuming
mattwparas 43b9dd3
remove erroneous no such command when the command succeeds
mattwparas 6e8fa50
bump steel to fix windows
mattwparas 85eab83
fix command and arg parsing with typed commands
mattwparas 9bb634a
Merge pull request #16 from RatCornu/steel
mattwparas 170e506
wip
mattwparas 35c9a3d
start working on some docs
mattwparas 82ad9c1
update steel
mattwparas 416642d
update
mattwparas e684c7d
setup embedding
mattwparas 5c6620b
remove debug prints
mattwparas 0c96732
Merge pull request #21 from mattwparas/mwp-embedded-modules
mattwparas c69f11b
fix merge
mattwparas 85f99f8
Merge pull request #22 from mattwparas/mwp-improving-docs
mattwparas 63086ee
feat: allow to get a register value from scheme
piotrkwarcinski edcb630
cleanup
piotrkwarcinski 0b5741f
attempt to get nix working
mattwparas e8614ce
use embedded dependencies instead of depending on external code gener…
mattwparas 75bf1a7
update steel to have fixed language server
mattwparas c0c3d69
Merge remote-tracking branch 'plugin-steel/steel-event-system' into h…
piotrkwarcinski d9ec722
Add documentation
piotrkwarcinski ec53eb4
dots
piotrkwarcinski de2496d
formatting
piotrkwarcinski ef4fe80
Merge pull request #24 from piotrkwarcinski/helix-plugin-register-value
mattwparas 81ee8ef
test experimental picker callback, use at your own risk (do not use u…
mattwparas 3f062fa
bring rust version back in line
mattwparas 848f2e2
instrument proper components module, start documentation
mattwparas 3b534ac
finish documenting component api
mattwparas a48abb7
just kidding, actually finish documenting the component api
mattwparas 56a083a
more documentation of configuration
mattwparas 64e4826
more documentation
mattwparas d04c95d
more docs
mattwparas e6b0bad
fix polluting the command palette with global steel functions
mattwparas 9492771
make sure docs don't show up for globals that aren't commands
mattwparas c0bb7c2
rename workspace function
mattwparas 54b3033
clean up, don't error on bootup if the helix file is missing
mattwparas 39f7244
fix init file and set up language configs
mattwparas 770d4d3
refresh language configs for open docs after update
mattwparas d3fb156
manually merge each field in the language config
mattwparas a2a97f1
properly handle lsp configs as well
mattwparas d451258
insert unknown lsps on update
mattwparas f9d83ac
remove some logging
mattwparas 2922687
allow writing registers from steel
tobiaskohlbau 3147f98
fix typo in find-workspace
tobiaskohlbau f249949
address warning nix build
tobiaskohlbau 9504a50
Merge pull request #27 from tobiaskohlbau/fixTypo
mattwparas 6de4235
have docs properly generate on code-gen
mattwparas 85bd47c
fix arity for ctx functions in components
mattwparas 39614b2
typo in theme-scope
mattwparas 9f0501d
when encountering an error in a dynamic component, pop off the stack …
mattwparas 67c5a2a
add function to check for key event
mattwparas 6ec0410
apply suggested naming
tobiaskohlbau aada3b5
add ability to ignore the command and close the component
mattwparas 9d88ce3
Merge pull request #28 from tobiaskohlbau/addressNixWarning
mattwparas 04697d6
Merge pull request #26 from tobiaskohlbau/writeRegisters
mattwparas aefdab6
fix arity on acquire-context-lock
mattwparas 3e57105
bundle ext library, upgrade steel, fix block on task
mattwparas fda1bbf
add macros for language configuration and lsp configuration
mattwparas 85e83d9
Fix call to exp-picker callback
piotrkwarcinski c5bd451
Merge pull request #29 from piotrkwarcinski/exp-picker-fix
mattwparas 863cf60
speed up the keymap api
mattwparas b3d55c0
clean up
mattwparas 0d509d6
update steel
mattwparas c1da27b
add missing bufferline option
mattwparas 977fc9e
add dynamic option config
mattwparas d7bdac1
add generated docs
mattwparas b321252
update steel
mattwparas c7273d7
add document saved hook
mattwparas 9f581f8
update steel, add new time primitives
mattwparas 01cfd2e
update steel
mattwparas bc01dda
check if a document has been modified
mattwparas f032f18
no longer install via git submodule, just use cargo install
mattwparas 3149754
bake in a high level theme api
mattwparas fe2ab35
fix theme api
mattwparas ba1fdac
use inferred steel lsp home location
mattwparas e2b81a2
punch out some more docs
mattwparas 82dce7a
ViewID equality (#30)
piotrkwarcinski 6f4b41c
keep component functions alive for the duration of the life cycle, sk…
mattwparas f40100a
dont lock the engine when grabbing the docs
mattwparas 8eae56f
merge latest from master
mattwparas 67f5b70
implement equality for some more types
mattwparas cae10b8
create init and helix files if they don't exist
mattwparas 3311c4e
update steel
mattwparas 7a006f7
clean up
mattwparas bf22478
clean up doc fetching
mattwparas b6b02c8
add docs for ropes
mattwparas 1eecadb
merge from master
mattwparas 2fe135c
set up integration to listen to lsp notifications that aren't handled…
mattwparas c1b5ff2
address warnings
mattwparas 7e0c438
remove some newlines
mattwparas bb1d8af
update steel docs and add more rope functions
mattwparas 1301c93
add rope docs
mattwparas d4fe0a0
update steel
mattwparas f582c8b
feat: add API for selection and ranges (#33)
nik-rev 629bb38
adjust inlay hint api to remove just based on character index and not…
mattwparas ec38807
add removing inlay hints by id to remove all invalidated inlay hints
mattwparas a35388a
add return value for the inlay hints removal
mattwparas 47b3ab8
update steel
mattwparas b858f9f
typos
mattwparas d4958e4
expose paste events in components
mattwparas b2c28b8
bump steel version
mattwparas 1393d14
set default name to be the id
mattwparas 081f9e8
update install instructions
mattwparas 45480fc
add range and selection conversions
mattwparas ef244de
don't set the status as void when the return value is void
mattwparas 3ee0e81
special case strings when setting the status to eliminate the quotes
mattwparas ef7ea0f
auto convert values to strings when logging
mattwparas 557aa9c
add warning and error
mattwparas 7e800e3
bump toolchain version for weird windows c abi incompatibility that i…
mattwparas 7a8db55
add key-modifier-super function (#46)
thomasschafer 8218db6
fix windows paths for registering additional search paths
mattwparas 46abe80
Add more fns to update selection ranges (#38)
meepleek f377c1c
added a selected-register! function for the plugin system for use wit…
mjkpolo e79005e
update steel
mattwparas bafe5bd
merge master
mattwparas 81e8ba8
address most of the comments
mattwparas 69c16ea
remove comment from toml
mattwparas 28bdf66
Add key-event-end? function (#51)
thomasschafer faaf0b8
update steel
mattwparas 2411202
update steel to fix regression with ffi-function creation
mattwparas 8d0a19a
fix bug with path function
mattwparas 152bf02
check equality on mode
mattwparas 9734ea3
add function to get the current column number (#49)
quantonganh ce21547
add function to get language for document (#53)
jdrst ec8971a
update steel
mattwparas 3f6d6fb
Add integration for handling LSP method calls (#45)
nikolaiser 2aad9cf
make notifications not take an id
mattwparas 8d11ab2
add accessors for event mode switch event
mattwparas 6990052
dont pass in context
mattwparas 96358f9
make adjustments to client non standard lsp implementation
mattwparas d0c4939
better name for a function
mattwparas dd42ed5
customize the cursor kind from dynamic components
mattwparas d426226
slot more things behind the feature flag
mattwparas db98b3e
merge from master
mattwparas 1e7d1b2
update to include rainbow brackets
mattwparas 16ebbce
add back lock file
mattwparas d8c27f2
fix sleep function
mattwparas f1403d5
Add send-lsp-notification Steel binding (#55)
npupko e137965
clean up
mattwparas 8cdb8af
move files around
mattwparas 055b2ea
clean up
mattwparas 14014cd
address comments
mattwparas 626d5e0
move steel out of default, use the xtask to install, otherwise manual…
mattwparas 069456e
gobbledy
mattwparas f8bc328
typo
mattwparas 374412a
fix post event dispatching
mattwparas 580702a
set the engine to be in a safepoint while idle
mattwparas ec24bef
properly check arity of typed commands
mattwparas 81a2f2e
Reload documents by ID (#50)
thomasschafer dbe0b76
create new (get-current-line-character) to give columns with encoding…
m4rch3n1ng 1454311
Add extra config options (#54)
gerblesh f94c9b2
Regex match on ropes (#57)
gerblesh b15b62d
fix some clippy warnings (#66)
m4rch3n1ng 9be9ad6
update steel
mattwparas 7bd8530
add some functions to get lsp clients and info from them (#64)
m4rch3n1ng 2270457
update steel
mattwparas 04c313f
add lsp-client-initialized?, check if client is init in offset-encodi…
m4rch3n1ng fc71806
merge from master
mattwparas 14c37a4
add back missing files from merge
mattwparas f44862e
add custom commands to command palette
mattwparas 0372e0a
don't unwrap language_server_name when it is None (#71)
m4rch3n1ng a853eaa
add ability to completely override keybindings
mattwparas a651517
move initialization up to avoid lsps starting with old config
mattwparas b57c48a
make the default not steel, again
mattwparas 17ecf38
merge from master
mattwparas 1c8de92
add missing inline diagnostics configs
mattwparas 03754b3
fix typo
mattwparas d04369a
have get-language-config return the actual configuration as a seriali…
mattwparas edd5f3a
update steel
mattwparas 7d7648f
handle deserializing values better
mattwparas 02b4281
move rust tool chain back down
mattwparas 00f73bb
downgrade imbl
mattwparas cea193b
downgrade archery version to get things behaving
mattwparas c6c7ba5
fix bad merge
mattwparas 990f1fd
undoing more bad merge stuff from termina
mattwparas f319b81
one step closer to windows fix
mattwparas 86f3efb
attempt to fix windows
mattwparas 42b1047
one more try
mattwparas a18c989
okay for real
mattwparas 4f4b356
(finally) add module for handling keymaps
mattwparas e872a19
don't crash if value doesn't exist
mattwparas 506bc71
add proper keywords to the keymaps macro
mattwparas b51143d
attempt merging keybinds
mattwparas 56e8658
fix integration build
mattwparas cde3d6c
update steel to fix init time regression
mattwparas af1a0ad
try to initialize the engine in the background
mattwparas 5ca50c8
fix keymaps macro
mattwparas 2e04ae5
add runtime flag for steel as well
mattwparas 571d241
merge from master
mattwparas 060e1d4
fix issue with xtask and generating sources
mattwparas 9fdc8ec
add support for reloading the whole engine, should work now
mattwparas 2e4c1db
add goto-col function:
mattwparas 4c7d951
query keybindings api
mattwparas d69b0c4
add goto-line
mattwparas 5bf9e04
add optional param to extend
mattwparas 50b3ec1
create mode from string
mattwparas ad81a9d
fix build for language server
mattwparas 01d2e73
fix bugs in keymap macro
mattwparas 0e286d1
fix keymap macro again
mattwparas 71cc471
change how keymaps are stored with length explanation
mattwparas 33f53f0
add another function for language server updating
mattwparas ce421e4
document a bunch of more configs
mattwparas 8d05b78
more config options
mattwparas 4b41b67
add statusline configuration
mattwparas 23b90f7
add more docs for statusline
mattwparas 9221623
union missing conf in keymaps
mattwparas c361b79
include additional docs
mattwparas c9b5e72
update docs
mattwparas 53786e4
fix callbacks on static commands
mattwparas ce7e90c
add one more patch
mattwparas e9e7bc2
update steel
mattwparas 5ef8dbd
fix some bugs with how keymaps get overlaid on to the global
mattwparas 86430a9
fix statusline function
mattwparas 148311c
add on key callback
mattwparas 66db9c9
on key event function
mattwparas 37807cc
decrease polling timeout in interrupt handler
mattwparas 1b948bd
trigger on key callbacks
mattwparas e151f16
merge from master
mattwparas 59f601e
updated STEEL.md to fix invalid function for helix.scm example (#78)
Cooksey99 17aecbd
add missing function
mattwparas e00034c
force re install
mattwparas 40f4b88
check engine bindings first for typed commands
mattwparas b366862
fix typed command calling
mattwparas 9044221
Push auto pairs config down to editor on change
mattwparas 92bc3db
implement equality for key events
mattwparas 4a9569c
fix string->editor-mode binding
mattwparas c87abc1
attempt to fetch the editor count
mattwparas 8e6f66a
add another check on if line is in bounds
mattwparas ae4fed2
update steel core
mattwparas 35229a6
update steel
mattwparas a7d6f79
set the error object when a callback to the main thread fails
mattwparas 2574e42
update steel
mattwparas a01f45b
update docs for buffer clear
mattwparas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| # Building | ||
|
|
||
| You will need a handful of things: | ||
|
|
||
| * A clone of this fork, on the branch `mwp-steel-integration` | ||
| * A clone of the steel git repo -> https://github.com/mattwparas/steel, on the branch `master` (default) | ||
|
|
||
| I also cannot promise that this will work on windows. I develop off of ubuntu and mac, so for now you can probably safely assume it will work on unix. | ||
|
|
||
| The `Cargo.toml` for helix points to a local development version of steel. Set this up so that it points to wherever you've cloned steel: | ||
|
|
||
| ``` | ||
| [workspace.dependencies] | ||
| # CHANGE 'path = ...' to point to the path to steel-core | ||
| steel-core = { path = "../../steel/crates/steel-core", version = "0.5.0", features = ["modules", "anyhow", "dylibs", "colors"] } | ||
| ``` | ||
|
|
||
| Since I'm actively developing steel alongside the helix integration in order to make things as smooth as possible, its not referencing a published version yet. | ||
|
|
||
| ## Installing Steel | ||
|
|
||
| Follow the instructions here https://github.com/mattwparas/steel and https://github.com/mattwparas/steel/issues/71 | ||
|
|
||
| Setting a `STEEL_HOME` env var, then running `cargo run -- cogs/install.scm` in the root of that repo will set up the steel core libraries so that helix can reference them. | ||
|
|
||
| ## Installing helix | ||
|
|
||
| Once you're set up with steel, just run | ||
|
|
||
| `cargo install --path helix-term --locked` | ||
|
|
||
| To install the `hx` executable, with steel as the plugin language. | ||
|
|
||
|
|
||
| ## Setting up configurations for helix | ||
|
|
||
| Note, this API is entirely subjet to change, and I promise absolutely 0 backwards compatibility while this is in development. | ||
|
|
||
| There are 2 important files you'll want: | ||
|
|
||
| * `~/.config/helix/helix.scm` | ||
| * `~/.config/helix/init.scm` | ||
|
|
||
| Note - these both live inside the same directory that helix sets up for runtime configurations. | ||
|
|
||
|
|
||
| ### `helix.scm` | ||
|
|
||
| The `helix.scm` module will be loaded first before anything else, the runtime will `require` this module, and any functions exported will now be available | ||
| to be used as typed commands. For example: | ||
|
|
||
|
|
||
| ```scheme | ||
| # helix.scm | ||
| (require-builtin helix/core/typable as helix.) | ||
| (require-builtin helix/core/static as helix.static.) | ||
| (require-builtin helix/core/keybindings as helix.keybindings.) | ||
| (provide shell git-add open-helix-scm open-init-scm reload-helix-scm) | ||
| ;;@doc | ||
| ;; Specialized shell implementation, where % is a wildcard for the current file | ||
| (define (shell cx . args) | ||
| ;; Replace the % with the current file | ||
| (define expanded (map (lambda (x) (if (equal? x "%") (current-path cx) x)) args)) | ||
| (helix.run-shell-command cx expanded helix.PromptEvent::Validate)) | ||
| ;;@doc | ||
| ;; Adds the current file to git | ||
| (define (git-add cx) | ||
| (shell cx "git" "add" "%")) | ||
| ;; Functions to assist with the above | ||
| (define (editor-get-doc-if-exists editor doc-id) | ||
| (if (editor-doc-exists? editor doc-id) (editor->get-document editor doc-id) #f)) | ||
| (define (current-path cx) | ||
| (let* ([editor (cx-editor! cx)] | ||
| [focus (editor-focus editor)] | ||
| [focus-doc-id (editor->doc-id editor focus)] | ||
| [document (editor-get-doc-if-exists editor focus-doc-id)]) | ||
| (if document (Document-path document) #f))) | ||
| ;;@doc | ||
| ;; Reload the helix.scm file | ||
| (define (reload-helix-scm cx) | ||
| (helix.static.run-in-engine! cx | ||
| (string-append "(require \"" (helix.static.get-helix-scm-path) "\")"))) | ||
| ;;@doc | ||
| ;; Open the helix.scm file | ||
| (define (open-helix-scm cx) | ||
| (helix.open cx (list (helix.static.get-helix-scm-path)) helix.PromptEvent::Validate)) | ||
| ;;@doc | ||
| ;; Opens the init.scm file | ||
| (define (open-init-scm cx) | ||
| (helix.open cx (list (helix.static.get-init-scm-path)) helix.PromptEvent::Validate)) | ||
| ``` | ||
|
|
||
| Now, if you'd like to add the current file you're editing to git, simply type `:git-add` - you'll see the doc pop up with it since we've annotated the function | ||
| with the `@doc` symbol. Hitting enter will execute the command. | ||
|
|
||
| You can also conveniently open the `helix.scm` file by using the typed command `:open-helix-scm`. | ||
|
|
||
|
|
||
| ### `init.scm` | ||
|
|
||
| The `init.scm` file is run at the top level, immediately after the `helix.scm` module is `require`d. The helix context is available here, so you can interact with the editor. | ||
|
|
||
| The helix context is bound to the top level variable `*helix.cx*`. | ||
|
|
||
| For example, if we wanted to select a random theme at startup: | ||
|
|
||
| ```scheme | ||
| # init.scm | ||
| (require-builtin steel/random as rand::) | ||
| (require-builtin helix/core/static as helix.static.) | ||
| (require-builtin helix/core/typable as helix.) | ||
| (define rng (rand::thread-rng!)) | ||
| ;; Picking one from the possible themes | ||
| (define possible-themes '("ayu_mirage" "tokyonight_storm" "catppuccin_macchiato")) | ||
| (define (select-random lst) | ||
| (let ([index (rand::rng->gen-range rng 0 (length lst))]) (list-ref lst index))) | ||
| (define (randomly-pick-theme options) | ||
| ;; Randomly select the theme from the possible themes list | ||
| (helix.theme *helix.cx* (list (select-random options)) helix.PromptEvent::Validate)) | ||
| (randomly-pick-theme possible-themes) | ||
| ``` | ||
|
|
||
| ### Libraries for helix | ||
|
|
||
| There are a handful of extra libraries in development for extending helix, and can be found here https://github.com/mattwparas/helix-config. | ||
|
|
||
| If you'd like to use them, create a directory called `cogs` in your `.config/helix` directory, and copy the files in there. In particular, `keymaps.scm` and `options.scm` are working well. | ||
|
|
||
| ### options.scm | ||
|
|
||
| If you'd like to override configurations from your toml config: | ||
|
|
||
|
|
||
| ```scheme | ||
| # init.scm | ||
| (require (only-in "cogs/options.scm" apply-options)) | ||
| (define *config-map* '((file-picker.hidden false) (cursorline true) (soft-wrap.enable true))) | ||
| (apply-options *helix.cx* *config-map*) | ||
| ``` | ||
|
|
||
|
|
||
| ### keymaps.scm | ||
|
|
||
| Applying custom keybindings for certain file extensions: | ||
|
|
||
|
|
||
| ```scheme | ||
| # init.scm | ||
| (require "cogs/keymaps.scm") | ||
| (define scm-keybindings | ||
| (hash | ||
| "insert" | ||
| (hash "ret" ':scheme-indent))) | ||
| ;; Grab whatever the existing keybinding map is | ||
| (define standard-keybindings (helix-current-keymap)) | ||
| ;; Overlay the scm keybindings on top of the standard keybindings. This does a little mutation here, so its a bit funky looking. | ||
| (merge-keybindings standard-keybindings scm-keybindings) | ||
| ;; For .scm files, use this keybinding set insteead | ||
| (set-global-buffer-or-extension-keymap (hash "scm" standard-keybindings)) | ||
| ``` | ||
|
|
||
| In insert mode, this overrides the `ret` keybinding to instead use a custom scheme indent function. Functions _must_ be available as typed commands, and are referred to | ||
| as symbols. So in this case, the `scheme-indent` function was exported by my `helix.scm` module. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
helix/core/keybindingsseems renamed tohelix/core/keymaps