fix tree-sitter

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2023-01-19 13:32:48 -05:00
parent 361f59ab28
commit 5c06ae218a
3 changed files with 18 additions and 40 deletions

View File

@ -19,7 +19,7 @@ in {
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacsUnstable; package = pkgs.emacsUnstable-nox;
init = { init = {
enable = true; enable = true;
@ -345,6 +345,10 @@ in {
web-mode = { web-mode = {
enable = true; enable = true;
mode = [ ''"\\.html\\'"'' ''"\\.tmpl\\'"'' ]; mode = [ ''"\\.html\\'"'' ''"\\.tmpl\\'"'' ];
config = ''
(define-derived-mode typescript-tsx-mode web-mode "TypeScript-tsx")
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
'';
}; };
# org-mode # org-mode
@ -407,45 +411,6 @@ in {
tide.enable = true; tide.enable = true;
typescript-mode.enable = true; typescript-mode.enable = true;
tree-sitter.enable = true;
tree-sitter-langs.enable = true;
graphql-mode.enable = true;
tsx-mode = {
enable = true;
package = epkgs:
epkgs.trivialBuild {
pname = "tsx-mode.el";
packageRequires = with epkgs; [
graphql-mode
coverlay
lsp-mode
origami
(epkgs.trivialBuild {
pname = "tsi";
packageRequires = with epkgs; [ tree-sitter tree-sitter-langs buttercup ];
src = pkgs.fetchFromGitHub {
owner = "orzechowskid";
repo = "tsi.el";
rev = "6fba6a4c61125e95c5ff744d1e9cb8ec17d6d4e4";
sha256 = "WgaFCpZeb81AdM77/DQnDdk7mVRK+NMJcoB/DxvCMx8=";
};
preferLocalBuild = true;
allowSubstitutes = true;
})
];
src = pkgs.fetchFromGitHub {
owner = "orzechowskid";
repo = "tsx-mode.el";
rev = "d9d1fda2929de59082c1dc34636271d4341c3b68";
sha256 = "fa0dHRfXVCNRiKFtW/+Zg4hWES9M+CrvJjQXiScdaTo=";
};
preferLocalBuild = true;
allowSubstitutes = true;
};
mode = [''"\\.tsx\\'"''];
};
deno-fmt = { deno-fmt = {
enable = true; enable = true;
config = '' config = ''

View File

@ -72,6 +72,7 @@
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
nixpkgs.overlays = [ nixpkgs.overlays = [
emacs-overlay.overlay emacs-overlay.overlay
(import ./overlays/tree-sitter-typescript.nix)
]; ];
}) })
./common ./common

View File

@ -0,0 +1,12 @@
final: prev: {
tree-sitter-grammars = prev.tree-sitter-grammars // {
tree-sitter-typescript =
prev.tree-sitter-grammars.tree-sitter-typescript.overrideAttrs (_: {
nativeBuildInputs = [ final.nodejs final.tree-sitter ];
configurePhase = ''
tree-sitter generate --abi 13 typescript/src/grammar.json
tree-sitter generate --abi 13 tsx/src/grammar.json
'';
});
};
}