[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc-mode fontification feels random

From: João Távora
Subject: Re: cc-mode fontification feels random
Date: Sat, 05 Jun 2021 19:46:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joost Kremers <joostkremers@fastmail.fm>
>> Date: Fri, 04 Jun 2021 22:11:06 +0200
>> > 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].
>> 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.  

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]