Bug 8294 - Language servers cannot handle our source tree modules
Summary: Language servers cannot handle our source tree modules
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-25 15:35 CET by Pierre Ossman
Modified: 2024-01-30 13:16 CET (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2024-01-25 15:35:09 CET
When installed, we put all our Python modules in /opt/thinlinc/modules/thinlinc. That is not how things are organised in the source tree, though. Instead, what ends up in thinlinc/ is spread out over many folders, only to be merged in the final build steps.

This confuses language servers, as they try to follow the same semantics as Python itself¹. That means, only one directory can contain the modules for the "thinlinc" package. So the language server often only finds some of our modules.

Modern Python has an alternative to packages called "namespaces". This allows using multiple directories with the same name to be searched for modules. We can probably abuse this to get something working. E.g. by not having any __init__.py in the source tree, and packaging it is as part of the build process instead.

We could consider dropping __init__.py completely. But that could decrease robustness, as Python would search multiple places for "thinlinc" modules. And there should just be one such directory.

¹ https://github.com/microsoft/pyright/issues/2882

Note You need to log in before you can comment on or make changes to this bug.