emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: toml-ts-mode: first draft


From: Jostein Kjønigsen
Subject: Re: toml-ts-mode: first draft
Date: Mon, 12 Dec 2022 14:10:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

On 12.12.2022 00:01, Yuan Fu wrote:
Looks great!
Thanks!
+  (unless (treesit-ready-p 'toml)
+    (error "Tree-sitter for TOML isn't avilable”))

Treesit-ready-p already raises a warning when something goes wrong. So you want 
to either pass the QUIET argument or let it do the barking ;-)

Yuan

Sure, I can fix that.

I notice though that this is not applied consistently in the other tree-sitter based major-modes.

From json-ts-mode.el:

>  (unless (treesit-ready-p 'json)
>   (error "Tree-sitter for JSON isn't available"))

From csharp-mode.el:

>  (unless (treesit-ready-p 'c-sharp)
>    (error "Tree-sitter for C# isn't available"))

From typescript-ts-mode.el:

>  (when (treesit-ready-p 'tsx)
>    (treesit-parser-create 'tsx)

From python.el:

>  (when (treesit-ready-p 'python)
>    (treesit-parser-create 'python)

I see in the (treesit-ready-p) it clearly throws when language is missing.

So from what I can tell all of the "established" forms are doing too much:

* checking return-value (not required because of throwing)
* creating errors

Could you recommend 1 specific form, and I'll try to stick to that, at least for toml-ts-mode (and then we can clean up those other modes later on).

--
Jostein




reply via email to

[Prev in Thread] Current Thread [Next in Thread]