`axaml` code completion not available when `UseArtifactsOutput` is used; incomplete otherwise
Describe the bug
It appears that when using UseArtifactsOutput (new addition in .NET 8), Avalonia is incapable of finding the build artifacts, such that the Build the project pop-up appears even after building the project.
When not using UseArtifactsOutput, completion is still incomplete, only suggesting the closing tag for the root element (e.g. </Application>). This may be caused due to being on an Avalonia version above the suggested 11.0.2, but I'm not sure (the README only mentions that the previewer will not work).
To Reproduce
- Create or open any Avalonia project in Visual Studio Code.
- Clear (
dotnet clean) or remove thebin/andobj/directories for the test project. - Create (
dotnet new buildprops) or open aDirectory.build.propsfile in the root of the workspace. - Add a
<UseArtifactsOutput>true</UseArtifactsOutput>element. - Attempt to receive code completions in any
axamlfiles.
Avalonia for VS Code
v0.0.31
Avalonia version
11.0.6
VS Code version
1.87.0
Relevant log output
None.
Additional context
No response
https://github.com/AvaloniaUI/AvaloniaVSCode/blob/7e167c75df8953cb0c3a7a94ea25886c4df7cc2c/src/AvaloniaLSP/AvaloniaLanguageServer/Models/ProjectInfo.cs#L52-L74
This Path.Combine(ProjectDirectory, "bin", "Debug") is incompatible with projects using artifacts path. IsAssemblyExist will be always false for them.
https://github.com/AvaloniaUI/AvaloniaVSCode/blob/7e167c75df8953cb0c3a7a94ea25886c4df7cc2c/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs#L80-L83
And this check on IsAssemblyExist will prevent completion engine from being initialized.
I have to put fake zero byte .dll file to allow completion to kick in.
Could we get some info on this? It's entirely impossible for me to use Avalonia in VSCode due to this problem.
Where might one start working on fixing this? How can we get the IntermediateOutputPath from the project?
When we improved the MSBuild property resolution in this fork, we noticed that similar issues have been resolved. You might want to try it out.