From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#61866: 29.0.60; Eglot: Dir-local workspace config doesn't work as described Date: Tue, 28 Feb 2023 13:38:37 +0100 Message-ID: <87cz5uarsi.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23873"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: 61866@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 28 13:39:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pWzGE-0005yz-7v for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Feb 2023 13:39:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWzG6-0002vc-8a; Tue, 28 Feb 2023 07:39:06 -0500 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 1pWzG2-0002vL-Jr for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2023 07:39:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWzG2-0002pr-BQ for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2023 07:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWzG2-0006XJ-6X; Tue, 28 Feb 2023 07:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: joaotavora@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Feb 2023 12:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61866 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Received: via spool by submit@debbugs.gnu.org id=B.167758792625099 (code B ref -1); Tue, 28 Feb 2023 12:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Feb 2023 12:38:46 +0000 Original-Received: from localhost ([127.0.0.1]:49880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWzFl-0006Wk-Vo for submit@debbugs.gnu.org; Tue, 28 Feb 2023 07:38:46 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:41642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWzFj-0006Wc-Kt for submit@debbugs.gnu.org; Tue, 28 Feb 2023 07:38:44 -0500 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 1pWzFj-0002nt-Eq for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2023 07:38:43 -0500 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWzFh-0002nx-En for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2023 07:38:42 -0500 Original-Received: by mail-ed1-x535.google.com with SMTP id eg37so39115751edb.12 for ; Tue, 28 Feb 2023 04:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=WAgSMThWePapqEWSbALFaZac5uN+C5Vjo011X92FcH0=; b=TCi69O9F/pAqs6XZYwzJXqM89m7ukgOAYFkxbA/d/28kNR5uVfasbW5p9sTwRQieT6 52gs3o6Tbtmb2LsYdrMxwCPDn5pm5Z5UqLLhjkwbSfh0C0eg7WTdbmwFT2kB+SLDEd6k GBVuJ465ZlEFfWmFieWq1qUtNMoBQ32xm5yMcaSk6NZMmR5bjMEkg0XSWO/SNCWe9Jhn saiaS2kDEwawVS33fZplx8hp8ugYFl1W1alkb5sUWFNWLcJFPbgikGS7KFDm1e6kSa1w AD3iGOJ/BLzEBNbCiHn/wJ4N2t4Yro0vpm1H/GZTeMxMq+8QjHLt76lWz6ehT9ekU3Xa IX4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WAgSMThWePapqEWSbALFaZac5uN+C5Vjo011X92FcH0=; b=SFndg0BEHvTorCheb03nINfRyOO6DC/4WIn9cfKSDlU+/TVHcTuPNoGQRK+9YCN5HD h6QfG5aldAMsGBv5rnEQ3s6JWp+sAcq0SYldPtpDdKfnm6FQyz7X6drheb9wyM9aGJSF YQ8xvGIeST/44rF/JbdZO/zZr08V4+xQVBbhBC4vS69uDzq5gOAyMx7uDv7bs7wAQfbM XCZmiIhKmOxDAkyp3O+/O+t79AqHjiUnRzdYZm2VY1LWYo3Fb0eXfa1TSHKb+pOsnfBM /m6QfYaRqfMeI/9DYkzv4Dayakp87t0x2rS3CSV48wdW8VCK5KrD3QGGIcTXUg3LU94i r4MQ== X-Gm-Message-State: AO0yUKUVGbFKeHQnyJLN367v67OEU+hbqyK4xi9s9YAlsUidH3FbQQ3Z E19IZ33j4VxBVMZP9j7yOY7ykS+Kt9S9Zg== X-Google-Smtp-Source: AK7set9ZtzGHuQMNwevtsxXpvZpAlv7IYELNA+852RH2I6DAfbM3KjhmRN90jCXNweCjNx0+bH4z6Q== X-Received: by 2002:a05:6402:134b:b0:4ab:4c5e:b0ed with SMTP id y11-20020a056402134b00b004ab4c5eb0edmr3325162edw.21.1677587918984; Tue, 28 Feb 2023 04:38:38 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id ha12-20020a170906a88c00b008f100fd50e5sm4578544ejb.140.2023.02.28.04.38.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 04:38:38 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256953 Archived-At: Quoting from the manual: > Here=E2=80=99s an example of defining the workspace-configuration setting= s [...] > > ((python-mode > . ((eglot-workspace-configuration > . (:pylsp (:plugins (:jedi_completion (:include_params t > :fuzzy t) > :pylint (:enabled :json-false))))))) > (go-mode > . ((eglot-workspace-configuration > . (:gopls (:usePlaceholders t)))))) The above doesn't work. > Alternatively, the same configuration could be defined as follows: > ((nil > . ((eglot-workspace-configuration > . (:pylsp (:plugins (:jedi_completion (:include_params t > :fuzzy t) > :pylint (:enabled :json-false))) > :gopls (:usePlaceholders t)))))) But this version does. To see why, patch eglot-signal-didChangeConfiguration as follows: (defun eglot-signal-didChangeConfiguration (server) "Send a `:workspace/didChangeConfiguration' signal to SERVER. When called interactively, use the currently active server" (interactive (list (eglot--current-server-or-lose))) (message "=3D> %s %s" (current-buffer) default-directory) (jsonrpc-notify ...) Then you'll see that upon first starting the server, one gets: =3D> *temp* ~/project_dir/ Presumably, the temp buffer is in fundamental mode. Note also that if you later do `M-x eglot-signal-didChangeConfiguration RET', then the that buffer's local value of `eglot-workspace-configuration' is used, since: =3D> actual_file.py ~/project_dir/subdir [ This behavior is confusing and reinforces my opinion that server information should be kept away from buffer-local variables. Related glitch: if you have two servers running, A and B, and then, from a buffer in project A you do M-x eglot-show-workspace-configuration RET and select server B in the prompt, you get server A's information. ] There's probably no better place than dir-locals to store "workspace" (aka project) configuration. But it would be better to then record this configuration in the server object after it's read for .dir-locals.el, and provide some UI to modify the configuration on the fly if desired.