Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Better Intellisense for .NET MAUI XAML files #565

Closed
danardelean opened this issue Sep 27, 2023 · 26 comments
Closed

[BUG] Better Intellisense for .NET MAUI XAML files #565

danardelean opened this issue Sep 27, 2023 · 26 comments
Labels
area-intellisense Issues specific to IntelliSense area-maui enhancement New feature or request triaged The issue has been triaged vs-sync Add this label to synchronize the issue to AzDo vs-syncd Linked to AzDO
Milestone

Comments

@danardelean
Copy link

danardelean commented Sep 27, 2023

Describe the Issue

Right now the Intellisense for the .NET MAUI XAML is minimal and it cannot be easily used to replace the editing capabilities that Visual Studio for MAC has (cannot find properties if never used, sometimes gives wrong suggestions for the control : for example the xmlns autocomplete for a control in the project is suggested wrong and it won't even compile the project.

We need better support for the .NET MAUI XAML files

Steps To Reproduce

Both Release and Preview versions have the same problems

Expected Behavior

I would expect to work as the code editor Visual Studio for MAC has

Environment Information

macOS

VS bug #1894443

@danardelean danardelean added the bug Something isn't working label Sep 27, 2023
@microsoft-issue-labeler microsoft-issue-labeler bot added the area-project Project load, Solution Explorer label Sep 27, 2023
@timheuer timheuer added area-maui and removed area-project Project load, Solution Explorer labels Sep 28, 2023
@mauroa mauroa added triaged The issue has been triaged vs-sync Add this label to synchronize the issue to AzDo labels Sep 29, 2023
@mgoertz-msft
Copy link
Member

@danardelean Rest assured, we are working on it. We have an entire Experience for this in our product backlog that we are currently working on. It requires extensive changes to the XAML Language Service engine in VS though to be able to reuse it for VS Code, so this will take a while.

@mgoertz-msft
Copy link
Member

@mauroa Do you know how to sync this issue to VS Experience #1777602?

@Marflage
Copy link

I have a related question: How to configure the intellisense to show only those properties for a XAML tag that are applicable in a given context? For example, if I am using a Button then after pressing CTRL+Space, I would like only those properties to be displayed that the Button tag supports; not all of the properties. I get confused as to what property would work for a given tag. I guess what I am trying to achieve is the way . notation works for an instance variable in any programming language. Does anybody know a way to achieve that? I am new to XAML and .NET MAUI.

@mgoertz-msft
Copy link
Member

@Marflage That's exactly the purpose of the real XAML Language Service and how it works in VS. We are working on bringing that experience to VS Code. In the time being you are better off using VS or VS Mac.

@AesBiarenti
Copy link

AesBiarenti commented Oct 19, 2023

I look forward to the updates you will bring for XAML VsCode. Because XAML is quite dysfunctional in VsCode. For example, it gives "default namespace not declared" error for "ContentPage" tag.

@arunchndr
Copy link
Member

@mauroa Do you know how to sync this issue to VS Experience #1777602?

I believe Microsoft foundation wont be directly linkable in the azdo bug unfortunately.

@timheuer
Copy link
Member

@mgoertz-msft Why did we close this? Can we keep this open as the public tracking one?

@mcyenikoylu
Copy link

Version: 1.85.1 (Universal)
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:48:06.308Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin x64 22.6.0

MacOS Ventura 13.6.3 (22G436)

As I write code, it memorizes it and brings only what is stored in its memory.

https://www.youtube.com/embed/B0kuOCWXkas?si=eniObTOrSSZdZjI9

@roughiain
Copy link

Does this include intellisense for bindings?

@mgoertz-msft
Copy link
Member

@roughiain What we are working on will be powered by the same underlying IntelliSense engine as in the regular Visual Studio IDE, so while the UI in VS Code may be different the actual IntelliSense completions should be the same for both products including Bindings, StaticResources, etc.

And for Binding IntelliSense to work we need to have a BindingContext or x:DataType set in XAML to provide us the shape of the object being bound to, but that's no different from the regular Visual Studio IDE.

@ravitejaavv
Copy link

@mgoertz-msft do we have any update on Intellisense auto suggestions for XAML files?

@Dry-Rusk
Copy link

@mgoertz-msft do we have any update on Intellisense auto suggestions for XAML files?

+1

@mgoertz-msft
Copy link
Member

@ravitejaavv, @Dry-Rusk, tl;dr It's still under development.

There are multiple things that need to happen in Roslyn first, one of which just completed yesterday: dotnet/roslyn#71758

This now needs to be inserted back into VS where the classic XAML IntelliSense code lives, so we can start consuming it.

However, there is another issue we are blocked on: dotnet/roslyn#71114 because ever since Roslyn started using its own internal LSP protocol types in December we are no longer able to register LSP handlers for XAML or use External Access APIs with the public VS LSP Protocol types.

@ravitejaavv
Copy link

@ravitejaavv, @Dry-Rusk, tl;dr It's still under development.

There are multiple things that need to happen in Roslyn first, one of which just completed yesterday: dotnet/roslyn#71758

This now needs to be inserted back into VS where the classic XAML IntelliSense code lives, so we can start consuming it.

However, there is another issue we are blocked on: dotnet/roslyn#71114 because ever since Roslyn started using its own internal LSP protocol types in December we are no longer able to register LSP handlers for XAML or use External Access APIs with the public VS LSP Protocol types.

Thanks for the update. Is there any tentative timeline to close the development ?

@mgoertz-msft
Copy link
Member

I wouldn't want to speculate on when we would release the first preview. We have run into a few surprises along the way that turned out to be quite costly timewise. But we will certainly make it known when there is something for everyone to try.

@EntityBox
Copy link

@Marflage That's exactly the purpose of the real XAML Language Service and how it works in VS. We are working on bringing that experience to VS Code. In the time being you are better off using VS or VS Mac.

VS MAC was retired and does not support .NET 8 - As a MAC user, I'm left with no option for Intellisense. This is a huge setback on coding. Might have been easier to add .Net 8 Support on VS MAC whilst this is being sorted. Sigh

Now we code a .Net 7 VS MAC project, copy the code to VS Code for .Net 8 - duplicating efforts and wasting time.

I hope this gets pushed to the priority list soon after the Roslyn fixes.

@mgoertz-msft
Copy link
Member

FYI, VS Mac is not out of support yet, and it does have a preview option for using it with .NET 8, so you should be able to use it in the meantime.

@EntityBox
Copy link

EntityBox commented Mar 15, 2024

@mgoertz-msft - WOW, searched for it and enabled it. Thanks so much.

For others looking for it:
Preferences > Other > Preview Features.

image

Copy link

github-actions bot commented Apr 3, 2024

This issue has been marked as stale after 14 days of inactivity. @[ @ @], could you please take a look?

@mgoertz-msft
Copy link
Member

The issue may be stale but the work is still progressing regardless. :)

@mgoertz-msft
Copy link
Member

I'm happy to announce that we have released the first preview of XAML IntelliSense for .NET MAUI today.

image

To try it out please follow these steps:

  • Install the current pre-release of the C# extension - v2.30.24 (pre-release)
  • Install the current release of the C# Dev Kit - v1.5.20
  • Install the current pre-release of the .NET MAUI extension - v0.11.87 (pre-release)

Let us know what you think. Enjoy!

@mcyenikoylu
Copy link

@mgoertz-msft I'm so glad to hear this and tested it now. everything works as it should. This is great! :) thanks..

My environment:

  • MacOS Sonoma 14.4.1 (23E224)
  • VS Code Version: 1.89.1

Extensions:

  • C# v2.28.11
  • C# Dev Kit v1.5.20
  • .NET MAUI v0.10.61

@mgoertz-msft
Copy link
Member

And thank you @timheuer for finding the first bug. The editor.onTypeFormatting setting causes errors when typing in XAML:

image
leads to
image

@mgoertz-msft
Copy link
Member

@mcyenikoylu Your C# extension version looks too old. The first one with XAML IntelliSense support is today's prerelease version: v2.30.24 (pre-release)

If you're on the release channel for the C# extension try to switch to prerelease. Otherwise, restart VS Code to see if you're offered to update the C# extension.

Of course, that makes me wonder how "everything works as it should"...?

@mgoertz-msft
Copy link
Member

And it's now available in Release, so Switch to Release and grab the latest updates:

  • C# - v2.30.28
  • C# Dev Kit - v1.6.8
  • .NET MAUI - v0.11.96

Enjoy bug fixes, including @timheuer's from above, and rich completion item tooltips:

image

@mgoertz-msft
Copy link
Member

@mauroa This has been released. Do you have permissions to close this issue?

@mgoertz-msft mgoertz-msft added the area-intellisense Issues specific to IntelliSense label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-intellisense Issues specific to IntelliSense area-maui enhancement New feature or request triaged The issue has been triaged vs-sync Add this label to synchronize the issue to AzDo vs-syncd Linked to AzDO
Projects
None yet
Development

No branches or pull requests