From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Eliachevitch Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Explain a bit more on how to configure language server in Eglot's manual Date: Wed, 15 Mar 2023 19:26:31 +0000 Message-ID: <87y1nxn1ia.fsf@posteo.de> References: <86sfeisu49.fsf@stephe-leake.org> <87356gvkkb.fsf@gmail.com> <87wn3jgof2.fsf@posteo.de> <878rfzt0h7.fsf@posteo.de> <833566ry3v.fsf@gnu.org> <87o7oudv7s.fsf@posteo.de> <87lejx6e1f.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16235"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 15 22:34:19 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcYlG-00042D-WF for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Mar 2023 22:34:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcYkV-0001mN-On; Wed, 15 Mar 2023 17:33:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcYkU-0001lP-8d for emacs-devel@gnu.org; Wed, 15 Mar 2023 17:33:30 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcYkR-0000R1-7a for emacs-devel@gnu.org; Wed, 15 Mar 2023 17:33:29 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 98E41240624 for ; Wed, 15 Mar 2023 22:33:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1678916002; bh=YTV5xmeY/SI7zAvIVNcTZYcavQIusR0BGKToSU/Hmp4=; h=From:To:Cc:Subject:Date:Autocrypt:OpenPGP:From; b=AVpUVP4dR3HvhUhdemkoG4mAKXNb51SJi2gZfSoNIKuR6jSZ/WJdfQTwWrv1O5NXD yvTGzsOK8EKVcpOXdGYcFJWxJQ3TcfbWL57n/ujNEnYlchCVP+rOQQRjs57BMbIY4I GruT7z8D4iFB98mcabNDvGVYY6do6Plx/9WxgvFZrTPY9i5RJwba+fmrXWoOamCcCN FFUJ+w97fAxI3XWldObAF60fqrNBzIdv8ndXirPehti6e/KLEuSA8oqZkJ39CgwfKn KN1RxAK52ihySBoE9LdRfMx1nb7Mplhg6OAmHYzwpX6qXX5KzZyHFTtvQpssd1yt4z VclNjxNDUJioQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PcNt90BP6z9rxQ; Wed, 15 Mar 2023 22:33:18 +0100 (CET) In-reply-to: <87lejx6e1f.fsf@gmail.com> Autocrypt: addr=m.eliachevitch@posteo.de; keydata=xsBNBFHFxZABCADAAv2siayhA7Etl85WcwcyMPBD2bt/6Wh3A8a12AURV5J4tprzgbdlxC0w1LofvklG7ls25NERAY931hvQW+f5GEI0pwoNNFXEkKDa8/J4SxhrqXx8CJA85owPq1g4cFeO1ooQJ32BewlRGsnhd+taYExZ76oaMnFtx6jYjf6mPbjDyiLhC+Og3MBpOqAnmX7mhStgJl0uru1ZGEB17tzzVuQ4ljDv/MvUagVFymQBhmlbzvze5eLeDn90Ot0DjWHy3HzCFMEnVqQy8rmEA8N9GOANwyMY79KVymsPakeNwacPRFzYXCZvolC5jtY6I/1ALvVtNc45JyZWty+rMPo3ABEBAAHNGG0uZWxpYWNoZXZpdGNoQHBvc3Rlby5kZcLAlAQTAQgAPhYhBFRpCMeCODrQ59iU7BuPlcgSXc4xBQJgUmWNAhsDBQkSToKgBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEBuPlcgSXc4xqC8H/06lkI7BimgkSobuEzsD9LsIPEyz5uUaQAP77u1nfoO1vB0DEdPxn7f3H3Hs7nyUfPgvgsn+9rTSV+ubHH5f/bzgQZgES2WItbV7iM290j6nWSc/iCTLlTmM2KMNvbMB9xGzV0m+UjMyAa9zUhB/3N+rd5ya/oSiTKw2/UbgfM5fR1knIUgPDENlKjJvO7/71Sxwpc+gKvAR9lHRT8JzQMyFaFO+zbo53Z7FzDTuj7zVyQ4MPIhe+UMI4rtNZeyPDM0QTep0+N39JbDhvUVevOh 15XJTYXl2Zdhl/yunnOibtg3XKtToakc4FjWJGrw8njbges5YqaodeMq OpenPGP: url=https://posteo.de/keys/m.eliachevitch@posteo.de.asc Received-SPF: pass client-ip=185.67.36.66; envelope-from=m.eliachevitch@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304505 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; format=flowed > Hmmm. I don't use "pylint" but what sense does it make to disable it > entirely (supposedly, that's what :enabled :json-false does) and then > _also_ pass args to it. Should we just enable it? This is all pretend, > of course. But shouldn't it make more sense? Ooops. I had simply looked through the available pylsp options [1] seeing which are of array type and would fit into the example plist that we already have. But you're right it doesn't make much sense here [2]. Instead, I would prefer to set some other array option from [1]. There are many more plugin options, but most of them are better set in python project configuration files (including the earlier pylint args), so personally I never use them. In the now attached patch v3 I set `pylsp.plugins.jedi_completion.cache_for', as we already have a :jedi_completion key (and it's enabled). By default it caches ["pandas", "numpy", "tensorflow", "matplotlib"]. One might want to extend the default list, but to keep the example short I just set it to a subset of the default. What do you think about that? [1]: See https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md [2]: When I'm pedantic (:pylint (:enabled :json-false)) also doesn't do anything since pylint is disabled by default, but I see some value in being explicit so I think for an example it's fine. > "Lisp" should be capitalized (pedantically, "Elisp", since vectors in > other dialects have different read syntax, but Lisp is fine) In the patch below I use "Elisp vectors" now. I would be fine with you editing the patch if you find some minor things to improve or have a better idea for the example. Git commits can have co-authors (this is what github does when you accept suggestions from reviewers), but not sure how the typical workflows are on emacs-devel (I just recently joined to keep up-to-date with recent developments). Or should the patch submitter must aggregate all suggestions into a final patch themselves? > I'll push the patch soon it with a > > Copyright-paperwork-exempt: Yes > > cookie, since this seems to fall under the "trivial" basket, but you > should probably get a FSF copyright assignment for future contributions. I'll try that soon. This patch changes just a couple of lines of documentation, so I hope it's fine for now. Slowly I'm figuring out this mailing list workflow and with the copyright assignment, there would be no hurdles for larger contributions to Emacs in the future :) Michael Eliachevitch --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=v3-0001-Document-how-to-set-JSON-arrays-in-eglot-workspac.patch Content-Transfer-Encoding: quoted-printable Content-Description: v3 of patch for eglot jsonrpc array documentation From=20d7a083c791a8a09db2f6a67603816c92baa9b690 Mon Sep 17 00:00:00 2001 From: Michael Eliachevitch Date: Tue, 14 Mar 2023 22:47:37 +0100 Subject: [PATCH v3] Document how to set JSON arrays in eglot-workspace-configuration Many language server configuration options are lists of the JSON array datatype, for example argument lists for executables. These can be configured in emacs lisp as vectors. The eglot documentation talked about confiring json as plists and introduced some basic json datatypes, but didn't yet mention arrays, which this commit introduced. Other changes * Align property lists in eglot documentation, so that keywords of the same level are aligned * Slightly change punctuation before code example to better grammatically integrate the example code and the text. =2D-- doc/misc/eglot.texi | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 735da5f0163..d3d4337af89 100644 =2D-- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1201,7 +1201,7 @@ User-specific configuration The argument @code{(:compilationDatabasePath "/tmp")} is Emacs's representation in plist format of a simple JSON object @code{@{"compilationDatabasePath": "/tmp"@}}. To learn how to =2Drepresent more deeply nested options in this format, @xref{JSONRPC +represent more deeply nested options in this format, @pxref{JSONRPC objects in Elisp}. =20 In this case, the two examples achieve exactly the same, but notice @@ -1214,7 +1214,7 @@ User-specific configuration @code{eglot-workspace-configuration}, a variable originally intended for project-specific configuration. This has the same effect as giving all your projects a certain default configuration, as described =2Din @xref{Project-specific configuration}. Here is an example. +in @ref{Project-specific configuration}. Here is an example: =20 @lisp (setq-default eglot-workspace-configuration @@ -1241,17 +1241,21 @@ JSONRPC objects in Elisp For representing the JSON leaf values @code{true}, @code{false}, @code{null} and @code{@{@}}, you can use the Lisp values @code{t}, @code{:json-false}, @code{nil}, and @code{eglot-@{@}}, respectively. +JSON arrays are represented as Elisp vectors surrounded by square brackets +(@pxref{Vectors,,,elisp,GNU Emacs Lisp Reference Manual}). =20 =2DFor example, this plist: +For example, the plist =20 @lisp (:pylsp (:plugins (:jedi_completion (:include_params t =2D :fuzzy t) =2D :pylint (:enabled :json-false))) + :fuzzy t + :cache_for ["pandas" "numpy"] + :pylint (:enabled :json-false)))) :gopls (:usePlaceholders t)) @end lisp =20 =2DIs serialized by Eglot to the following JSON text: +@noindent +is serialized by Eglot to the following JSON text: =20 @example @{ @@ -1259,7 +1263,11 @@ JSONRPC objects in Elisp "plugins": @{ "jedi_completion": @{ "include_params": true, =2D "fuzzy": true + "fuzzy": true, + "cache_for": [ + "pandas", + "numpy" + ], @}, "pylint": @{ "enabled": false =2D-=20 2.40.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFNBAEBCAA3FiEEVGkIx4I4OtDn2JTsG4+VyBJdzjEFAmQSOZ0ZHG0uZWxpYWNo ZXZpdGNoQHBvc3Rlby5kZQAKCRAbj5XIEl3OMeBPCACjUbC2/p2O9x0BT/x9zJHW pwbQiUsT4JToo9mwEUHX7oqcL9Skxrzh7DojuanJjmz6xWzUksTP06BZ0vDqyV5h n4OS8cPewvoq0CGPxtJW1bkRxCIA+xfvpEDAYqalyOg9RfhMzvzqEKbBKgN5Bcbj /KMFjKknr7H5HANXteEVlpb1APRAAhjZSeOlDfSbgoqnYGFphDtDnDyim3rs17w3 vfUTk9KWRUHR73EqeXJbx36Fzr3y3AkYM9NvQZYJNxup/UkWrx2XZZ811LH69Gwe VtaQrdrRPI1W1cUfJ87rwS0YTdokF2RK0fqdaluzafJNsQcv1NvebzH1I2awDK+V =fKWb -----END PGP SIGNATURE----- --==-=-=--