zeroc-ice / vscode-slice

Slice syntax highlighter for Visual Studio Code
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Language server ignores / doesn't use built-in types #20

Closed bernardnormier closed 10 months ago

bernardnormier commented 10 months ago

With version 4.1.0.

I am using an IceRpc::ServiceAddress. The code compiles fine but the Language Server is not happy:

[{
    "resource": "/C:/Users/bernard/source/repos/icerpc-ice-csharp-interop/tests/Interop.Tests/Slice/TagTests.slice",
    "owner": "_generated_diagnostic_collection_name_#5",
    "code": "E049",
    "severity": 8,
    "message": "no element with identifier 'IceRpc::ServiceAddress' exists",
    "source": "slicec",
    "startLineNumber": 18,
    "startColumn": 45,
    "endLineNumber": 18,
    "endColumn": 67
}]
ReeceHumphreys commented 10 months ago

This is intentional behavior - if you want to use built-in types, you must point the language server to them in the reference directories configuration.

We initially discussed baking the well-known types into the language server but decided not to do it; I cannot remember why. Do you think we should be baking them in @bernardnormier

bernardnormier commented 10 months ago

I don't find the current behavior sensible.

In general, when you look at a Slice file in a C# project, if this Slice file compiles fine in that project, the Slice extension should not show any error in that file.

As far as slicec-cs is concerned, there is no baked-in file. They are all regular "reference files".

externl commented 10 months ago

Right now we don't parse the c# files to try and sort your the users slice compilation. If you want to be able to reference our built-in types, the references configuration will need to be updated.

I'm also not sure that there's a good way for us to parse these cs project files, though I haven't looked.