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: cc-mode fontification feels random Date: Sat, 05 Jun 2021 19:46:05 +0100 Message-ID: <87v96sw3o2.fsf@gmail.com> References: <831r9iw473.fsf@gnu.org> <87h7ieyma7.fsf@gmail.com> <15be7dd8-e901-e317-5111-e1a34f6f0416@gmail.com> <83k0n9l9pv.fsf@gnu.org> <83eedhl83r.fsf@gnu.org> <8735txfkk7.fsf@fastmail.fm> <837dj8ls7d.fsf@gnu.org> 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="38334"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Joost Kremers , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 05 20:46:53 2021 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 1lpbJt-0009hh-6D for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Jun 2021 20:46:53 +0200 Original-Received: from localhost ([::1]:54298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpbJs-0002dB-2M for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Jun 2021 14:46:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpbJD-0001wx-EG for emacs-devel@gnu.org; Sat, 05 Jun 2021 14:46:11 -0400 Original-Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:51815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpbJB-0006eX-QD; Sat, 05 Jun 2021 14:46:11 -0400 Original-Received: by mail-wm1-x32f.google.com with SMTP id r13so7311112wmq.1; Sat, 05 Jun 2021 11:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=S6FyCSByh3pkMMYutUjw01rDZVxfAptcOGG9frCAces=; b=EtgPwc8vHPMI2pPrxiCli7rJU/6IzRkJ54cZSWtzPvS0sRe/QXTiM6DXqePng340N9 E0RXAiLrq+/2yJHzFmXk79rHfRBHEuNTvcrnRg4t1vRAoEwKzHFRyiKPOkJOdFaFKQxq lwSxwf4KI69GeyWBfp5aud8rpxmJuiEGQyjRnErDsGNtDDfGPCI5OjNr9SvVf9Inv8rr zLa0KKWg6W8kH/R4YQVgJtuG97q2dFdNR/fDWMrbGytsfAikbrwlMH8Z/siROx3RtSRR TNMKgfL73KBTwrqsBVlqkZ6Bnw85vDO6T3F//W34vYLmAKmizUx0FHCjWhvdCuiYivky L6ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=S6FyCSByh3pkMMYutUjw01rDZVxfAptcOGG9frCAces=; b=cTKOzbYws8oAXmkX8kwbPmhvWoccielxQdHeAe2b58sV9QVAKvZHbp7xvH3vW5FHx+ V/9wcquahh/C2wlFBe5sE3TEbXe2EgsgxuFKzk8ZE1npdZcSepSd6nsGnDU96ANILEgA YEj4J3mVWZ8/plWCct/8TslAsDMYXIX4OxQur3UGS1+J6/JpVGuUbtFpqzQihqrTRTeO 6Qdp1K8plWX0zqT6sDcpsImVxShybXjQVaQy+RMa245Vx7ipPv1y2MiqRu0dpQrnAPSn Zeo+FvwRXQsuzgKyoWZriehMm5I9OHkZSKJpGIJ9TrJqPgmaa1HUkg6zr/mlCN2NG8Xc IUdg== X-Gm-Message-State: AOAM531ZBLPxRsKaRIa2knYoZ3WUzkf7W7ucRkvbot+sPLXTQEPLF5JF PLFVq0Pd5yZIEyB5vFyRae4ySbbokUA= X-Google-Smtp-Source: ABdhPJx/ybK08VFTaBJxOUkSwIXd89dllUdGufFYczlYOtBPwqSFqf33YP4A/4MwLg5eR4vgcZtrTA== X-Received: by 2002:a05:600c:3647:: with SMTP id y7mr9376537wmq.149.1622918767530; Sat, 05 Jun 2021 11:46:07 -0700 (PDT) Original-Received: from krug (a94-133-55-152.cpe.netcabo.pt. [94.133.55.152]) by smtp.gmail.com with ESMTPSA id j9sm6418514wrs.49.2021.06.05.11.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Jun 2021 11:46:07 -0700 (PDT) In-Reply-To: <837dj8ls7d.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Jun 2021 09:51:34 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x32f.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.23 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" Xref: news.gmane.io gmane.emacs.devel:270445 Archived-At: Eli Zaretskii writes: >> From: Joost Kremers >> Date: Fri, 04 Jun 2021 22:11:06 +0200 >>=20 >> > I'm not an expert on the internals of LSP servers, but it's my >> > understanding that for a language server like clangd, it needs access >> > not just to the current file, but the entire source tree[1]. >>=20 >> And speaking from my experience with lsp-mode (not eglot) and Python, it= needs >> access to the entire virtual env so it can provide type information and >> completions for built-in Python packages and for 3rd-party packages that= you use >> your code. > > That cannot be a mandatory requirement, right? Because otherwise LSP > wouldn't be able to support editing of an unfinished project, where > not everything is laid out 100% yet.=20=20 You're mostly right. Most good servers give some level of support even if they can't make out the whole project. And clangd is one of them, in my experience. It'd likely be able to fontify perfectly just by looking at the file. Of course, to be able to relate compilation units and provide full completion they must understand the project and the linking between units (unfortunately, this requires duplicating much of one's makefile in a compile-commands.json or equivalent, though there are tools that try to automate that). But "seeing" the whole project isn't generally a problem as LSP usually run in the same host where the project lives. They don't see the project through Emacs, they only see the "document" through Emacs, which acts as the LSP client. A "document" is similar to a file-visiting-buffer. Jo=C3=A3o