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.devel Subject: Re: Explain a bit more on how to configure language server in Eglot's manual Date: Wed, 08 Mar 2023 16:01:17 +0100 Message-ID: <87lek78eyq.fsf@gmail.com> References: <86sfeisu49.fsf@stephe-leake.org> <87356gvkkb.fsf@gmail.com> <87r0tz8jag.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="33791"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu , Stephen Leake , Emacs developers To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 08 16:02:07 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 1pZvIt-0008fe-8y for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Mar 2023 16:02:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZvIN-0008EB-Bw; Wed, 08 Mar 2023 10:01:35 -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 1pZvIH-0008B4-IV for emacs-devel@gnu.org; Wed, 08 Mar 2023 10:01:31 -0500 Original-Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZvIF-0001Dl-7r for emacs-devel@gnu.org; Wed, 08 Mar 2023 10:01:29 -0500 Original-Received: by mail-ed1-x531.google.com with SMTP id cy23so66809224edb.12 for ; Wed, 08 Mar 2023 07:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678287680; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7Amq6NlpC3HSPVrmQfFv56milvPu2lyT+xSWEf7F0pA=; b=El1hKGvkcLk8Z9vIVIWuf4hg83WIPaWLQCOnglVaPPjgtAgG4BJdp/+TSI7l+BnjP4 DFGbiUEChksiDnAWwrwy4c1D1MQy1kh0sSfuoCL29SJQrApMegiXYzsEe0CKAvDqMLuk 99mx5Za4ZxgKhAMRSXBeEu/hBjMdJMJh3zqGc/EVtHG1yti/5/ROYgoAEIacUfoxgtrc cAexo7l/WiRtIkZUHBv7F65gUhMWqcnGovn5BuQmzZTfi75G3I5AXbnL2svL+HnNd6TZ F2HWiQxasEzr9gehoB2d0h450/gYclpQLH52b8UGz6oS0WHtTUR685bzGVHS18kI3eAm t3Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678287680; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7Amq6NlpC3HSPVrmQfFv56milvPu2lyT+xSWEf7F0pA=; b=2PhnAz19FhF3la0csxP//qvO7XXv/oEBUkcxdPs88oReK+4OhDPDmTKX2N+wtUcPzG vdJsM1k+yOFIn5SJtulrjhB5ZUVnVC0flIqGaH6m0Et8HsX+3iWrhFhWG5thmJ359PWI 8p+KmcH8JGmyPvdb+u5FD54chHToNbWi0BmTD00+F5ER117KpLuZW7gJCny+xE2uNtGZ KTLFc5k+wznGB8w+XS2BiXQZHLe2BU1FKZntYjI1mitxah3xFPSrAj/h3WjMR0tCIKxH eLLuqflp7qMM4lcXpogijgCMY26Uv1eKqx/5w1iZsPexlSD1M5bXutXf5iYMHIXbB9KQ YwFA== X-Gm-Message-State: AO0yUKUWD5bdR7WkFym0WumRBgVlvqC3yBNF0boF8ofhAkE5yvWrVb+W 7mKDNZEqvVXgkZVtszULNqwDtiynJoUuIA== X-Google-Smtp-Source: AK7set9W0A3lHoTO/rqSJYhLX7i4hH1JC1zdKERKPaZrHo+qLPso3Fv81EcjQkXgjj/4CYnlOZt0+g== X-Received: by 2002:a17:906:224d:b0:8f4:732e:40bf with SMTP id 13-20020a170906224d00b008f4732e40bfmr19703635ejr.16.1678287679630; Wed, 08 Mar 2023 07:01:19 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id y4-20020a170906524400b008d71e08c78dsm7495008ejm.81.2023.03.08.07.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 07:01:18 -0800 (PST) In-Reply-To: (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vora=22's?= message of "Wed, 8 Mar 2023 13:54:55 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x531.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: 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:304138 Archived-At: On Wed, 8 Mar 2023 at 13:54, Jo=C3=A3o T=C3=A1vora wrote: >> > The dotted-to-plist translator proposed is optional. Some people >> > requested use of dotted notation and that will surely need a >> > translator. I wouldn't use it. >> >> Given how selective you are with the features you want to add, I don't >> understand why you think this particular one should make it in. It >> would sure help a little, maybe, sometimes. > > I don't understand: didn't you state you _like_ dotted notation? Yes, as a quick fix. But you and the circumstances showed that it isn't nearly good enough. > A special plist editing mode for a single Eglot variable falls into > that category, IMNSHO. By the way, my suggestion is to edit a JSON value, which is what the server receives, you can copy and paste from other places, and doesn't require you to know jsonrpc.el internals such as :json-false and the translation of nil. > Dotted option notation does not. It seems to be an LSP practice, It may be a practice, but the ground truth is a JSON object. > and I don't see any other good place to put a single utility function > that facilitates it but in Eglot. The utility function belongs to map.el. It is called `assoc-in` in Clojure. Speaking of bloat, and I know I shouldn't insist, but a basic version of the savable eglot-show-workspace-configuration barely adds 30 LOC. I'm pasting it here in case it helps anybody. --8<---------------cut here---------------start------------->8--- (defvar-local eglot-wsconf--server nil) (defvar eglot-wsconf-map (let ((map (make-sparse-keymap))) (define-key map "\C-c\C-c" #'eglot-wsconf-commit) map)) (defun eglot-wsconf-commit () (interactive) (let ((wsconf (save-excursion (goto-char (point-min)) (jsonrpc--json-read)))) (save-window-excursion (let ((default-directory (project-root (eglot--project eglot-wsconf--= server))) (buffers (buffer-list))) (add-dir-local-variable nil 'eglot-workspace-configuration wsconf) (save-buffer) (if (memq (current-buffer) buffers) (bury-buffer) (kill-buffer)))) (eglot-signal-didChangeConfiguration eglot-wsconf--server) (quit-window t))) ;;;###autoload (defun eglot-wsconf-edit (server) "Edit the language server workspace configuration." (interactive (list (eglot--read-server "Show workspace configuration for"= t))) (pop-to-buffer (eglot-show-workspace-configuration server)) (use-local-map eglot-wsconf-map) (setq-local header-line-format (substitute-command-keys "\ Press \\[eglot-wsconf-commit] to commit changes")) (setq eglot-wsconf--server server)) --8<---------------cut here---------------end--------------->8---