ethan-leba / tree-edit

🌲 Structural editing in Emacs for any™ language!
GNU General Public License v3.0
395 stars 16 forks source link

`dash` not found when attempting to generator new language files #62

Closed jesse-c closed 1 year ago

jesse-c commented 2 years ago

Hey! tree-edit is fantastic. I've wanted common structural editing for so long, and Treesitter seems to be the way forward.

Elixir is the primary language I use at work, so I thought that I would try and add it. I'm stuck at generating the required files though as the Emacs dash package isn't being found.

I added it to the Cask file.

diff --git a/Cask b/Cask
index 662a999..6167461 100644
--- a/Cask
+++ b/Cask
@@ -10,4 +10,5 @@
  ;; relies on tree-edit (which causes a dependency error). manually declaring
  ;; the deps. instead.
  (depends-on "evil")
+ (depends-on "dash")
  (depends-on "avy"))

Shell output:

jesse@lima-default:~/src/github.com/ethan-leba/tree-edit$ ~/.emacs.d/elpa/cask-0.8.9pre/bin/cask
Loading package information... done
Package operations: 12 installs, 0 removals
  - Installing [ 1/12] s (0.0.0)... done
  - Installing [ 2/12] reazon (0.4.0)... done
  - Installing [ 3/12] tree-sitter-langs (0.10.0)... done
  - Installing [ 4/12] tsc (0.15.0)... already present
  - Installing [ 5/12] tree-sitter (0.15.0)... already present
  - Installing [ 6/12] avy (latest)... done
  - Installing [ 7/12] dash (latest)... done
  - Installing [ 8/12] evil (latest)... done
  - Installing [ 9/12] buttercup (latest)... done
  - Installing [10/12] emacs (24.1)... already present
  - Installing [11/12] cl-lib (0.5)... already present
  - Installing [12/12] goto-chg (1.6)... already present
jesse@lima-default:~/src/github.com/ethan-leba/tree-edit$ ~/.emacs.d/elpa/cask-0.8.9pre/bin/cask emacs --script dev/tree-edit-generate-grammars.el ~/src/github.com/emacs-tree-sitter/tree-sitter-langs/repos/elixir/src/grammar.json elixir elixir-mode
Cannot open load file: No such file or directory, dash

I'm relatively new to Emacs, so there may very well be something silly that I'm missing. I tried this both on macOS and then on a Ubuntu VM.

Update: It's not just dash, it's just that that it's in the first require call in dev/tree-edit-generate-grammars.el.

ethan-leba commented 2 years ago

Hey! Thanks for checking out the repo :) I actually have some major changes to the generate grammars logic in a local branch so that may or may not address this issue you're hitting here! I don't think tree-edit is useable as-is and I sadly don't have time/energy to work on it this semester so I'd honestly advise against using it currently, hopefully I'll be able to have some time to get the project into a more usable state this winter.

jesse-c commented 2 years ago

Ah, that makes sense! Structured editing is sort of my dream for my daily editing, so I'm keen to see how it goes—though no pressure. Best of luck with school too 😅

ethan-leba commented 1 year ago

Hi again! I've finally cleaned up and pushed my code to main so tree-edit is once again in a (semi-) working state, now using emacs29 tree sitter. I've done a basic check on the elixir grammar and there doesn't seem to be any immediately catastrophic errors :) Would love to hear feedback if you get a chance to try to pick this up again!

Here's the code I used to test: https://github.com/ethan-leba/tree-edit/commit/dfde62a35915045f355a161737342dcd874a41e8

Two notes:

  1. Elixir grammar has alot of external grammar nodes, haven't looked into the difficulty of addressing those but will likely need to be special cased
  2. Doing anything at a top-level now is likely to freeze b/c the relational parser falls over after a large enough number of nodes (not elixir specific). In the python grammar I added an override for blocks, prob need to do the same for elixir