emacs-devel
[Top][All Lists]
Advanced

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

Re: User experience: eglot configuration


From: Ship Mints
Subject: Re: User experience: eglot configuration
Date: Thu, 30 Jan 2025 06:45:24 -0500

Check out the following which illustrates how you can use json in string form (from a file or wherever you want) and coerce it into an eglot-supported equivalent lisp object (it shows the round-trip serializer/parser round-trip ability). You can have both lisp and json configurations with a tiny bit of extra work.

(let* ((foo-lisp
        '( :pylsp
           ( :plugins
             ( :jedi_completion ( :include_params t
                                  :fuzzy t)
               :pylint (:enabled :json-false)))))
       (foo-str "{\"pylsp\":{\"plugins\":{\"jedi_completion\":{\"include_params\":true,\"fuzzy\":true},\"pylint\":{\"enabled\":false}}}}")
       (foo-from-lisp (json-serialize foo-lisp
                                      :false-object :json-false
                                      :null-object nil))
       (foo-from-str (json-parse-string foo-str
                                        :object-type 'plist
                                        :null-object nil
                                        :false-object :json-false)))
  (message "string from lisp:")
  (pp foo-from-lisp)
  (message "object from string:")
  (pp foo-from-str)
  (message "is object from string equal to a literal lisp object? %S" (equal foo-from-str foo-lisp)))

-Stephane

On Thu, Jan 30, 2025 at 4:17 AM Harald Kirsch <pifpafpuf@gmx.de> wrote:


On 29.01.25 21:01, chad wrote:
>
> On Wed, Jan 29, 2025 at 8:06 AM Pedro Andres Aranda Gutierrez
> <paaguti@gmail.com <mailto:paaguti@gmail.com>> wrote:
>
>     ... Or rephrasing:
>     if the LSP wants JSON, why elisp -> JSON and not JSON directly?
>     Would be easier
>     to debug...
>
>
> Am I misunderstanding, or are you saying that it would be easier to
> write raw JSON than lisp?

Yes. 100%! In particular for people who would use Emacs as a code editor
or IDE replacement for their language, one which much more likely had
them look at JSON configs already in whatever context, than at Lisp.

Harald

--
--------------+---------------------------------------
Harald Kirsch | HaraldKi@nrw.social


reply via email to

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