Genio-The-Haiku-IDE / Genio

The Haiku IDE
Other
59 stars 9 forks source link

Incomplete outline for ColumnTypes.cpp (in Haiku source) #376

Closed humdingerb closed 1 month ago

humdingerb commented 2 months ago

If you open /src/kits/interface/ColumnTypes.cpp in the Haiku source tree, you only get one entry in the Outline pane: gSystemCatalog

Something's not right...

nexus6-haiku commented 2 months ago

Has the compile db been generated?

humdingerb commented 2 months ago

How can I tell? I just did a "Open project..." and opened the /src/kits/interface folder. Then opened the file ColumnTypes.cpp.

nexus6-haiku commented 2 months ago

Just a bit of context on how clangd (the Language Server) works. It uses the AST produced by clang (the compiler) which in turn needs to know how to compile the translation units that are part of a C++ project. The compile db is a list of the options and parameters needed to compile the project and can be produced in different ways. We explain this in Configuring-clangd-lsp.md. Without it clangd may have an incomplete view of the entire AST and fail to resolve some symbols. Now, I'm just trying to figure whether this is your case.

humdingerb commented 2 months ago

FWIW, I don't see a "compile_commands.json" or "config.yaml" in any settings folder or project...

In any case, the outline works for other files in the same folder...

nexus6-haiku commented 2 months ago

2024-05-06_16-32

I open a project pointing to /src/kits/interface/, then I open whatever file and get the symbols within. Being them internal symbols in the file itself, I presume this would be quite trivial for clangd without requiring the compile db. Are these steps the same for you?

humdingerb commented 2 months ago

Yes. Only I get just the first, "gSystemCatalog"... I tried with this interface-kit project being "active" and not. No difference. Running current main Genio_debug, compiled a minute ago.

Curious.

nexus6-haiku commented 2 months ago

Are you on LLVM16 or 17?

humdingerb commented 2 months ago

I got these:

llvm12_libs-12.0.1-8-x86_64.hpkg llvm17_clang-17.0.6-1-x86_64.hpkg llvm17_libs-17.0.6-1-x86_64.hpkg

Freaxed commented 2 months ago

I could not reproduce.. if you have time, please run genio with low/off log level but with Trace log level for LSP. Open just the header file to keep the log noise at minimum. Thanks

humdingerb commented 2 months ago

Open just the header file to keep the log noise at minimum.

To clarify, the outline issue described happens when opening /src/kits/interface/ColumnTypes.cpp, not its header file.

Here are the logs when opening

lonemadmax commented 2 months ago

Not a clangd or LSP expert here, or even C++, so I may be talkng nonsense, but maybe there's nothing else because it can't tell whether they are class methods or namespaced functions or something else due to lack of declarations? For Control.cpp it gets the header file with the declarations from the system include path, but for ColumnTypes.cpp it can't because it's in private and that's not in the list (and without the compile db it doesn't know where else to look for it). Just for testing, could you try copying ColumntTypes.h in src/kits/interface?

jackburton79 commented 2 months ago

Ah sure! This might well be! That would also explain the different behaviour on different systems: maybe @Freaxed and @nexus6-haiku configured clangd differently by adding those paths in the configuration?

Freaxed commented 2 months ago

I agree, this could explain the behaviour. Anyway, by looking at the logs, Genio is correctly showing the only symbol sent by clangd (gSystemCatalog).

humdingerb commented 2 months ago

Just for testing, could you try copying ColumntTypes.h in src/kits/interface?

Indeed this 'fixes' my outline issue. Nice work, Sherlock Máximo! I guess there's nothing Genio can do in these cases and this is a closable non-issue?

jackburton79 commented 1 month ago

I guess that would work if we added the private headers folder into the clangd configuration, @Freaxed ? Unfortunately we can't provide that file on installation, right ?

Freaxed commented 1 month ago

AFAIK there are 3 ways to provide a configuration parameter: by command line, by local project file and by user settings file. We should investigate a bit on command line options or maybe we could create/update the user settings file.

Il giorno mer 22 mag 2024 alle ore 10:00 Stefano Ceccherini < @.***> ha scritto:

I guess that would work if we added the private headers folder into the clangd configuration, @Freaxed https://github.com/Freaxed ? Unfortunately we can't provide that file on installation, right ?

— Reply to this email directly, view it on GitHub https://github.com/Genio-The-Haiku-IDE/Genio/issues/376#issuecomment-2124122288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALC2DS4HHWEJ5XRSY5LS3TZDRGADAVCNFSM6AAAAABHDURDOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRUGEZDEMRYHA . You are receiving this because you were mentioned.Message ID: @.***>

lonemadmax commented 1 month ago

Is it worth it, though? Next thing is a header that is in the project but not in the installation. Or one that is different enough to cause confusion.

jackburton79 commented 1 month ago

Headers in the project folder are on thing, but would be nice to provide a nice experience out of the box, including also private and shared haiku headers, at least. On the other hand, the current situation isnt that bad and more advanced users should learn how to configure clangd and do themselves

jackburton79 commented 1 month ago

Anyway, let's close this for now.