From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Explain a bit more on how to configure language server in Eglot's manual Date: Sat, 4 Mar 2023 20:45:17 -0800 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) 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="16222"; mail-complaints-to="usenet@ciao.gmane.io" To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 05 05:46:26 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 1pYgGP-00040r-PR for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Mar 2023 05:46:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYgFd-0006Yo-8K; Sat, 04 Mar 2023 23:45:37 -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 1pYgFa-0006Ya-Ad for emacs-devel@gnu.org; Sat, 04 Mar 2023 23:45:34 -0500 Original-Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYgFX-0005ER-G2 for emacs-devel@gnu.org; Sat, 04 Mar 2023 23:45:32 -0500 Original-Received: by mail-pl1-x62d.google.com with SMTP id i5so6868384pla.2 for ; Sat, 04 Mar 2023 20:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677991529; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=WsF07BFfjB/oCTSu0fpjvStckjhREfakZSYnTgBEteU=; b=PLQwrl3CXOBFdN1TX0kRa/kkaPs7/NUHIxql9gEVI8GtRFyTUQN2mNZiQlfVLpIgZb iBx4x7FNoUjFlNYTJ3iYTxeRslgXVL6ZobkGeG4XpVQTxoyWnfaBQwUyJR3hr1jLnyaV bH/HHbawO749jObmCYAsAfaUPq8bDs8BR54mqgKEnH9f86JxbuasRbZ0+Qza4v3iK410 ugTRTJ08gUrxhvKBjPBVc7IoO6+HAVYN3kQDjNzttmtq/1bdUFJQXuqw23JWj8iHTta7 LBT+whPdb3st2D3hvmZ3sihhV+rlSrBt0amrwrwO7IYNQPZBZkcr59qJK9OISuMHyjtV 1JmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677991529; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WsF07BFfjB/oCTSu0fpjvStckjhREfakZSYnTgBEteU=; b=t/d2XYbeFPx4U+PcjIK8q8/+jSGMv0Eykl1GeTx5JmBIrvCv+Dv1cVNxhj7x1BZy6m ObccSr1ozsItMHV7hBOe9agCEQdJk/ItWBCc4WGhF+67o0vWV7lEEAcdbG8hK8JuKYT9 P03svq0dzI+MNSlW3+EBSr4K/BfK633H5qzLPdlXmp396pEoGaAoplryyMsCStiHULYN 2xDDu2aeWEfKpaLfA1sz9rzUxVNnwJ7NS+68XrJdtL+J/4o1Ec04U3XxGkMpnvGXsqLb X0kqmN6nuE0BQMHdROv6H7wmKKTQcfh4YndnAqw2T3segIlKbwGhP81T8KPG4VOnLeaO 8E6g== X-Gm-Message-State: AO0yUKVAedWLtekGJBfeEitgB4cLwpbqzt0cnxrLU85+HnKBxHACYYRA oUqdqfmEIPZ9qqt7Vl/RxK6PtHdZ1jy0Ow== X-Google-Smtp-Source: AK7set8IWDU00MD1pc+aSJWhlQRKEg5izV9Za9uOw43wIJBqNSrnMtOBK0Mvit9GpbVDzZJcrMYakg== X-Received: by 2002:a17:902:e5ce:b0:199:25d1:e559 with SMTP id u14-20020a170902e5ce00b0019925d1e559mr9411261plf.0.1677991529197; Sat, 04 Mar 2023 20:45:29 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id ba11-20020a170902720b00b00198e03c3ad4sm4029411plb.278.2023.03.04.20.45.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Mar 2023 20:45:28 -0800 (PST) X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=casouri@gmail.com; helo=mail-pl1-x62d.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:303958 Archived-At: Recently I was trying to use eglot with rust-analyzer and configure = rust-analyzer. It turns out more confusing than it should be, and I = think we can add a paragraph to eglot=E2=80=99s manual to help others = like me. LSP servers generally allow configuration through either LSP=E2=80=99s = workspaceConfiguration protocol or their custom configuration file. For = those who use workspaceConfiguration, it is common for the documentation = to say something like this: This is the list of config options rust-analyzer supports: rust-analyzer.assist.emitMustUse (default: false) blah blah blah =E2=80=A6 To pass this configuration to rust-analyzer through eglot, you need to = set eglot-workspace-configuration to=20 '(:rust-analyzer (:assist (:emitMustUse t))) However, it is not obviously clear how to interpret = =E2=80=9Crust-analyzer.assist.emitMustUse=E2=80=9D, not for someone = inexperience with LSP, at least. (OTOH, the manual explains very clearly = how to translate a JSON config to a plist, great job!) I suggest we add a sentence or a paragraph to the eglot manual = explaining that rust-analyzer.assist.emitMustUse translates to the JSON = configuration { "rust-analyzer": { "assist": { "emitMustUse": true } } } And the user should translate that to the plist format for = eglot-workspace-configuration. This is not something only rust-analyzer does. I surveyed a bunch of = language servers, all the servers that support LSP=E2=80=99s = workspaceConfiguration (typescript, rust, python, OCaml, Haskell, perl, = Java) describe their configuration in the xxx.xx.xxx format. Because = this is the format one can copy and paste into VSCode=E2=80=99s setting = file. We should probably also mention that the =E2=80=9Croot key=E2=80=9D (the = "rust-analyzer=E2=80=9D part) isn=E2=80=99t always the name of the = language server. Some server expects the language name rather than the = server=E2=80=99s name, ie, haskell rather than haskell-language-server. = Typescript expects =E2=80=9Ctypescript=E2=80=9D or =E2=80=9Cjavascript=E2=80= =9D, perl, ocaml, java expects language names, python expects = =E2=80=9Cpyls=E2=80=9D, the name of the server. Yuan=