[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-ts-mode 00a397204d 32/61: Major changed, to indent
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-ts-mode 00a397204d 32/61: Major changed, to indentation, font lock |
Date: |
Wed, 4 Sep 2024 04:00:28 -0400 (EDT) |
branch: elpa/haskell-ts-mode
commit 00a397204d31dd59660b0e56a63356591f61f3a7
Author: Pranshu Sharma <pranshusharma366@gmail.com>
Commit: Pranshu Sharma <pranshusharma366@gmail.com>
Major changed, to indentation, font lock
---
README.org | 30 +++++++++++++++++++++++++++++-
haskell-ts-mode.el | 19 ++++++++++++++++---
ss.png | Bin 0 -> 23881 bytes
3 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index 4baf9c8e2b..4cd1ddc5e8 100644
--- a/README.org
+++ b/README.org
@@ -1,13 +1,41 @@
* Context
-A haskell mode that requires treesitter and offers:
+A haskell mode that uses treesitter.
+
+The package is still in devlopment, please report bugs or email
+them(email found it main .el file).
+
+* Screenshot
+[[ss.png]]
+
+* Features
+The basic features are:
- Syntax highliting
- Indentation
- Imenu support
- REPL
- Prettify symbols mode support
+The more interesting features are:
+- Logical syntax highlighting:
+ - Only arguments that can be used in functions are highlighted, eg
+ in `f (_:(a:[])) only 'a' is highlighted
+ - The return type of a function is optionally highlighted, if
+ treesit-font-lock-level is set to 4
+ - All new variabels are(or should be) highlighted, this includes
+ generators, lambda args.
+ - highlighting the '=' operaotr in guarded matches correctly, this
+ would be stupidly hard in regexp based syntax
+- Unlike haskell-mode, quasi quotes are understood and do not confuse
+ the mode
+- Consistant indentation: haskell-mode's indentation works in a
+ cyclical way, it cycles through where you might want indentation.
+ haskell-ts-mode, meanwhile relies on you to set the parse tree
+ changing whitespace.
+- Significantly more perfomant than haskell(-tng)-mode, don't have a
+ number on this yet.
+
* Motivation
haskell-mode contains nearly 30k lines of code, and is
diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el
index e5d4777cbc..267ca6d70a 100644
--- a/haskell-ts-mode.el
+++ b/haskell-ts-mode.el
@@ -42,7 +42,7 @@
'((comment str pragma parens)
(type definition function args)
(match keyword)
- (otherwise)))
+ (otherwise signature)))
(defvar haskell-ts-prettify-symbols-alits
'(("\\" . "λ")
@@ -51,7 +51,7 @@
(defvar haskell-ts-font-lock
(treesit-font-lock-rules
:language 'haskell
- :feature 'parens
+ :feature 'parens
`(["(" ")" "[" "]"] @font-lock-operator-face
(infix operator: (_) @font-lock-operator-face))
:language 'haskell
@@ -79,9 +79,13 @@
`((type) @font-lock-type-face
(constructor) @font-lock-type-face)
:language 'haskell
+ :override t
+ :feature 'signature
+ `((signature (function) @haskell-ts-fontify-type))
+ :language 'haskell
:feature 'function
:override t
- `((function (variable) @font-lock-function-name-face)
+ `((function name: (variable) @font-lock-function-name-face)
(function (infix (operator) @font-lock-function-name-face))
(bind (variable) @font-lock-function-name-face)
(function (infix (infix_id (variable) @font-lock-function-name-face)))
@@ -286,6 +290,15 @@
'face font-lock-variable-name-face)
(mapc 'haskell-ts-fontify-arg (treesit-node-children node))))
+(defun haskell-ts-fontify-type (node &optional override start end)
+ (let ((last-child (treesit-node-child node -1)))
+ (if (string= (treesit-node-type last-child) "function")
+ (haskell-ts-fontify-type last-child)
+ (put-text-property
+ (treesit-node-start last-child)
+ (treesit-node-end last-child)
+ 'face font-lock-variable-name-face))))
+
(defun haskell-ts-imenu-node-p (regex node)
(and (string-match-p regex (treesit-node-type node))
(string= (treesit-node-type (treesit-node-parent node))
"declarations")))
diff --git a/ss.png b/ss.png
new file mode 100644
index 0000000000..4d2a168cc7
Binary files /dev/null and b/ss.png differ
- [nongnu] elpa/haskell-ts-mode 09a1d6647f 19/61: Fixed argument indenting, (continued)
- [nongnu] elpa/haskell-ts-mode 09a1d6647f 19/61: Fixed argument indenting, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode ebc222940f 24/61: typo, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode edc4f1dfc9 31/61: quasi quote body no indent, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 6a3c2d27e9 52/61: fixed electric pair, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode c0fe26d991 53/61: fixed defgroup error, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 1c017f310e 07/61: at, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 78b685d6ea 01/61: first commit, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode cc627feca3 05/61: added 'instance' to be highlighted, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode a0fbb19e80 18/61: Added installation instructions, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 38595a001e 12/61: Major indent fixes, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 00a397204d 32/61: Major changed, to indentation, font lock,
ELPA Syncer <=
- [nongnu] elpa/haskell-ts-mode 5178ff240f 13/61: nl indent fix, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 98660f4cce 28/61: Major changes to comment and indent, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode b6426584ca 15/61: Major updates, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 3e2e2aa769 14/61: fix comment, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 155bf79867 33/61: more indent fixes, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 113e443752 26/61: Fix quasiquotes, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 9c032dc8c4 44/61: Better formating and general code quality changes, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 1525dc1dc7 06/61: ic, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 020175db62 16/61: Major changes, ELPA Syncer, 2024/09/04
- [nongnu] elpa/haskell-ts-mode 9f450166d8 39/61: better docu, ELPA Syncer, 2024/09/04