From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Explain a bit more on how to configure language server in Eglot's manual Date: Wed, 8 Mar 2023 19:43:11 +0000 Message-ID: References: <86sfeisu49.fsf@stephe-leake.org> <87356gvkkb.fsf@gmail.com> <87r0tz8jag.fsf_-_@gmail.com> <87lek78eyq.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="27098"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuan Fu , Stephen Leake , Emacs developers To: Augusto Stoffel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 08 20:43:56 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 1pZzhY-0006rE-FY for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Mar 2023 20:43:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZzhB-0004F4-LM; Wed, 08 Mar 2023 14:43:29 -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 1pZzh9-0004Cx-Me for emacs-devel@gnu.org; Wed, 08 Mar 2023 14:43:27 -0500 Original-Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZzh8-0008Vk-2r for emacs-devel@gnu.org; Wed, 08 Mar 2023 14:43:27 -0500 Original-Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1767a208b30so17995772fac.2 for ; Wed, 08 Mar 2023 11:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678304604; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UNeTOlX8IpWDDR1FOMkmseVye1Sg3q2cT2DigNs2A6Q=; b=Jv48uVZEopab9Obl8CLXCKrD0TUzb6dTUeYfweOPJXuNHPw9P0sj6awgoCY1XG3j88 t5yWNUMb2LoKYe3gzq4Hw4ErsBZ9+4Ra4SUeVfcgc/Jh8AQvI4rmeIweAeAbK6OL97El 8GjTmjONpmOzDz1Ne5unZHUfqhMzUsmxJikfVOduyIJnTIQfaClRlIAMzSfVK/3IGG0u bn1onQMuMQdB9bzkPE20EuQNopUbyq7BI8dL9NwFrvXh+ETlKbkHk2uYCNKGw/kaT2tv U8ESBHrvJEGqiFUTWvsPtkyQu63+/nZCTa/CjpGDGHSE6uDzTBx9G/hkCMwrK0s7025e NB/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678304604; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UNeTOlX8IpWDDR1FOMkmseVye1Sg3q2cT2DigNs2A6Q=; b=mgsHQdTbKeuVQF9pRvqqlwqEmqG3XDJFhF35C7Lh7jjEJNTw4TeLw+S7aMMTANsDP2 jpHEN2cYwMY3Nt7fkgxoswsSR32a5I3yNLC/qDPfnz8T2xTwMuG+eX1zpJFi42zJ+yom VD+qFfK/aQ9UPGK170ibwzQ9p6m73kvuYu+5nwgALsHSqfvVxSYtpetmDQtf2FGM0pe5 qL6ogdvxfUTCSuP/4dZtaPnyDZbBdq/FWwsBMP7gTG6D2ER6/6XvIfuuOplhWV7XF2a+ /wyMuypx8CuJENb/6kEUZGwD1LxZ5HlqFNscV+uzaK/UpNLqxmG+HC75VYHInrbF1QsB 8hTA== X-Gm-Message-State: AO0yUKUCEc8D00Mt+VBy7Gzh84V3C3FS1VONqKLOZpIewdQzgZS1L0nT HEE3hhbhWQQ+r2CT7rqmFkJ52pKgH8Q8NVJtIJg= X-Google-Smtp-Source: AK7set9Az8Mx7yQgLGJJeF+kVJs2byg4bjVn8JZ5h3j7pcvwK44NN+Wtrh8uOnJbGi6xSlyuA7BBosd0AC9lrHl8ONA= X-Received: by 2002:a05:6870:954b:b0:176:207d:59c with SMTP id v11-20020a056870954b00b00176207d059cmr6808925oal.5.1678304604211; Wed, 08 Mar 2023 11:43:24 -0800 (PST) In-Reply-To: <87lek78eyq.fsf@gmail.com> Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=joaotavora@gmail.com; helo=mail-oa1-x33.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:304152 Archived-At: On Wed, Mar 8, 2023 at 3:01=E2=80=AFPM Augusto Stoffel wrote: > > 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. OK. Then we'll hold that idea back. AFAICT, Yuan also is also a fan of that notation, so maybe he can chime in. > > 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. They are not internals. They are the external, published and documented way to create JSON for jsonrpc.el contexts. The documentation isn't great, I know. This is precisely what this thread is originally about and I'm working on it. > > 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. Yuri presented some pretty good arguments about how that would be a bad idea. Also, not a Clojure expert, but AFAIK that function doesn't take dotted notation strings as input. > 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. Your code has at least two big problems: * it takes the current value from one place and potentially saves it in another place. This is asking for trouble. I know you favour the 'nil' method exclusively for setting e-w-configuration, but it's not the only supported methods and there are configurations out in the wild that we can't break. Also note the that per-file or per-sub-hierarchy workspace configurations _are_supported by LSP (the scopeUri argument to the workspace/configuration server request). * it doesn't take into account dir-local-set-class-variables These are exactly the type of edge cases that I don't want to handle in Eglot. In other words, Emacs has many variable setting methods and making an Eglot function to oversimplify them, even if it happens to work for an estimated majority of cases, is a bad idea, simply because it will break a minority. That said, your code has great ergonomics and you seem to be a very able Elisper. So I'll restate: if a generic, safe version of this hits Emacs libraries, Eglot will be happy to use it and I at least will be very grateful for that contribution. A better dir-local editing facility would account for (at least) those two cases. Even if that accounting is, at first, just bailing out and warning the user if it detects them. That's perfectly fine in my book. It'll mean the code will work fine for the 90% of users and not confuse the other 10% to death. That new dir-local editing facility could even allow you to use JSON notation to edit a variable's plist, and eglot.el could hint on that preference by setting 'serializer' and 'deserializer' properties on e-w-configuration (though a more lispy name would be 'write' and 'read' perhaps). Additionally, in eglot.el, a variable watcher could be added to e-w-c to take care of LSP signalling automatically if changes to the value are detected. So I urge you to generalize your code and propose it here in a new :core ELPA package. Thanks, Jo=C3=A3o