Giter Site home page Giter Site logo

avaloniaui / avaloniavscode Goto Github PK

View Code? Open in Web Editor NEW
96.0 4.0 12.0 1.77 MB

Visual Studio Code Extension for Avalonia UI

Home Page: https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.vscode-avalonia

License: MIT License

C# 32.30% TypeScript 67.05% Shell 0.66%
avalonia vscode vscode-extension wpf

avaloniavscode's Introduction

Avalonia for Visual Studio Code

Requires Avalonia v11.0.2 or lower

The extension require Avalonia nuget package v11.0.2 or lower. The latest version v11.0.5 of Avalonia package will break the previewer


Avalonia is a cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of Operating Systems such as Windows via .NET Framework and .NET Core, Linux via Xorg and macOS.

The Avalonia for Visual Studio Code Extension contains support for Avalonia XAML autocomplete and previewer.

Follow the contribution guide if you want to help us build the extension

Getting Started

Create a new Avalonia project

You can create a new Avalonia project directly from the Visual Studio Code

New Project

Additionally, you can create a project from the command line too, with the command:

$ dotnet new avalonia.app -o MyApp

This will create a new folder called MyApp with your application files. You can install Avalonia project templates with following command, if you do not have them installed already:

$ dotnet new install Avalonia.Templates

Finally open the MyApp folder in the VS Code, open any axaml file to activate the extension and code completion.

NOTE: You must build the project to enable code completion for now.

Enable Previewer

Previewer

After you load the project in the VS Code, you can click on Show Preview button on the editor toolbar (1)

The previewer requires that your project is built, and has required metadata. When you open the project for the first time, or clean the project. Click on Generate Assets button (2), and wait for a couple of seconds to preview the XAML file.

The previewer will refresh when you switch between multiple xaml files, unlike Visual Studio for Windows or Rider, VS Code will reuse the single preview window.

XAML Code completion

The Avalonia XAML in the VS Code is powered by the same code completion engine available for Visual Studio on Windows.

Rich syntax highlighter and contextual code complete will make it lot easier to read and write XAML files

Code completion

avaloniavscode's People

Contributors

bintoss avatar dependabot[bot] avatar jojorne avatar maxkatz6 avatar microhobby avatar prashantvc avatar signalmq avatar urtsisantsi avatar workgroupengineering avatar zhangchaoza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

avaloniavscode's Issues

Release checklist

  • Extension Icon
  • Color scheme
  • Dependencies
  • README file
  • Lincense file
  • Repository/Issue links
  • Verify version number
  • Publisher and author details

This is a sample issue

Type: Bug

Hello there

Extension version: 0.0.3
VS Code version: Code - Insiders 1.81.0-insider (Universal) (822ad2de026bf4cf858d17237937a3ca743d1b22, 2023-07-21T08:36:34.360Z)
OS version: Darwin arm64 23.0.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 3, 3
Memory (System) 32.00GB (2.09GB free)
Process Argv --crash-reporter-id 0dca3b99-dd0e-424d-97cc-4be51f2678a5
Screen Reader no
VM 0%
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vsdfh931:30280409
vshan820:30294714
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
py29gd2263:30784851
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
2i9eh265:30646982
showlangstatbar:30737417
7ij38806:30687742
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30771523
hideindicator:30766887
pythongtdpath:30726887
i26e3531:30792625
gsofa:30778558
pythonnosmt12:30779711
pythonidxpt:30768918
pythonnoceb:30776497
copilotsettingt:30767686
e537b577:30772214
h0f32768:30792099
asynctok:30795849
dsvsc013:30777762
dsvsc014:30777825
cmakesidepanelv2:30779593
diffeditorv2:30786206

Doesn't Work on Solutions in Directories with Spaces

I saw this in my "Extension Host" log

2023-09-08 16:07:50.235 [error] SyntaxError: Unexpected token 'E', "
Error: Unk"... is not valid JSON
	at JSON.parse (<anonymous>)
	at updateSolutionModel (c:\Users\ssarette\.vscode\extensions\avaloniateam.vscode-avalonia-0.0.17\out\services\solutionParser.js:62:23)
	at Socket.<anonymous> (c:\Users\ssarette\.vscode\extensions\avaloniateam.vscode-avalonia-0.0.17\out\services\solutionParser.js:98:13)
	at Socket.emit (node:events:513:28)
	at addChunk (node:internal/streams/readable:324:12)
	at readableAddChunk (node:internal/streams/readable:297:9)
	at Readable.push (node:internal/streams/readable:234:10)
	at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Dug into it a bit to find the cause...

Error: Unknown command 'Thing'.

       c:\Users\ssarette\work\repos\Example Thing  3\Proj\Example.sln
                                            ^^^ No such command

Restructure repository

VS Code extension has duplicate of completion engine code in the repo.
Add the completion engine as submodule instead

Previewer not working in Linux.

I see another dev is having issues with the .AXAML previewer in Linux (issue #58), so I'm not alone. My distro is MX Linux which is Debian based and closer to pure Debian than the Ubuntu family. My desktop environment is XCFE4.

I'm relatively new with Linux as a development platform. The Windows version of this extension works mostly okay with a few hiccups that I can deal with. But it stubbornly will NOT render the layout under my Linux desktop. That is the preview pane stays blank. The same .AXAML previews under Windows.

Notice the contributing guidelines recommend .NET Core 7.0, which I have installed. Yet for some reason the dotnet command line tools create a 6.0 version instead. Also I get my extensions from the VS Code marketplace (v0.0.20) and don't compile my own, not yet. So my extension is NOT compiled from GitHub.

Hopefully we can find a solution. Worse case scenario is I'll have to use Windows to design my UI layouts.

Build does nothing after restarting pc

I'm on Debian 12. I have no other extensions running other than C# base support and Avalonia for VSC.
When I build first time a project it works fine. XAML completion shows up.
If I then close my PC and reopen it, I'm stuck in a loop.
Screenshot_20230920_075259
I get the same prompt but pressing it does nothing. It says it is building but after a few seconds, the message disappears and I'm asked to build again.
Screenshot_20230920_075505

I have checked every output console but there is no errors or warnings. The only thing I could find is this

2023-09-20 07:59:48.475 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.475 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finding descriptors for completionItem/resolve | Method='completionItem/resolve'"
}


2023-09-20 07:59:48.475 [info] OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finding descriptors for completionItem/resolve | Method='completionItem/resolve'
2023-09-20 07:59:48.475 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.476 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Server.Matchers.ResolveCommandMatcher: Checking handler completionItem/resolve:AvaloniaLanguageServer.Handlers.CompletionHandler | Method='completionItem/resolve' Handler='AvaloniaLanguageServer.Handlers.CompletionHandler'"
}


2023-09-20 07:59:48.476 [info] OmniSharp.Extensions.LanguageServer.Server.Matchers.ResolveCommandMatcher: Checking handler completionItem/resolve:AvaloniaLanguageServer.Handlers.CompletionHandler | Method='completionItem/resolve' Handler='AvaloniaLanguageServer.Handlers.CompletionHandler'
2023-09-20 07:59:48.476 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.476 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Queueing Parallel:completionItem/resolve:8 request for processing | Type='Parallel' Name='completionItem/resolve:8'"
}


2023-09-20 07:59:48.476 [info] OmniSharp.Extensions.JsonRpc.ProcessScheduler: Queueing Parallel:completionItem/resolve:8 request for processing | Type='Parallel' Name='completionItem/resolve:8'
2023-09-20 07:59:48.476 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.476 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Starting: Processing request completionItem/resolve 8 | Method='completionItem/resolve' ResponseId='8'"
}


2023-09-20 07:59:48.476 [info] OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Starting: Processing request completionItem/resolve 8 | Method='completionItem/resolve' ResponseId='8'
2023-09-20 07:59:48.477 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.477 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Starting: Routing Request (8) completionItem/resolve | Id='8' Method='completionItem/resolve'"
}


2023-09-20 07:59:48.477 [info] OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Starting: Routing Request (8) completionItem/resolve | Id='8' Method='completionItem/resolve'
2023-09-20 07:59:48.477 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.477 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Converting params for Request (8) completionItem/resolve to OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem | Id='8' Method='completionItem/resolve' Type='OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem'"
}


2023-09-20 07:59:48.477 [info] OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Converting params for Request (8) completionItem/resolve to OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem | Id='8' Method='completionItem/resolve' Type='OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem'
2023-09-20 07:59:48.477 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.477 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Converting params for Notification completionItem/resolve to OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem | Method='completionItem/resolve' Type='OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem'"
}


2023-09-20 07:59:48.477 [info] OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Converting params for Notification completionItem/resolve to OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem | Method='completionItem/resolve' Type='OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem'
2023-09-20 07:59:48.477 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.478 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline: Updating Resolve items with wrapped data for completionItem/resolve:AvaloniaLanguageServer.Handlers.CompletionHandler | Method='completionItem/resolve' Handler='AvaloniaLanguageServer.Handlers.CompletionHandler'"
}


2023-09-20 07:59:48.478 [info] OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline: Updating Resolve items with wrapped data for completionItem/resolve:AvaloniaLanguageServer.Handlers.CompletionHandler | Method='completionItem/resolve' Handler='AvaloniaLanguageServer.Handlers.CompletionHandler'
2023-09-20 07:59:48.478 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.478 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Response value was OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem | Type='OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem'"
}


2023-09-20 07:59:48.478 [info] OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Response value was OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem | Type='OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem'
2023-09-20 07:59:48.478 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.478 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finished: Routing Request (8) completionItem/resolve in 0ms | Id='8' Method='completionItem/resolve' ElapsedMilliseconds='0'"
}


2023-09-20 07:59:48.478 [info] OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finished: Routing Request (8) completionItem/resolve in 0ms | Id='8' Method='completionItem/resolve' ElapsedMilliseconds='0'
2023-09-20 07:59:48.478 [info] [Trace - 07:59:48] Received notification 'window/logMessage'.
2023-09-20 07:59:48.478 [info] Params: {
    "type": 4,
    "message": "OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Finished: Processing request completionItem/resolve 8 in 0ms | Method='completionItem/resolve' ResponseId='8' ElapsedMilliseconds='0'"
}


2023-09-20 07:59:48.478 [info] OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Finished: Processing request completionItem/resolve 8 in 0ms | Method='completionItem/resolve' ResponseId='8' ElapsedMilliseconds='0'
2023-09-20 07:59:48.478 [info] [Trace - 07:59:48] Received response 'completionItem/resolve - (8)' in 5ms.

Typo in README.md

"Carrot will not reset between" should be "Caret will not reset between"

Preview not working, vscode Linux

About bug

The window preview not work, i did try Create Assets but not work.

When i open the http://127.0.0.1:8000/ in browser it show the Preview normally.

About Desktop

Host system: Linux Mint 21.1
Vscode: 1.83.1
Avalonia: 11.0.2
Extension: 0.0.20
Dotnet Version: 7.0.402

Preview in vscode:

image

Builded app:

image

Logs

2023-10-11 22:20:43.753 [info] Creating language service
2023-10-11 22:20:43.753 [info] Starting Avalonia Language Server...
2023-10-11 22:20:43.753 [info] [Trace - 22:20:43] Sending request 'initialize - (0)'.
2023-10-11 22:20:45.275 [info] [Trace - 22:20:45] Received response 'initialize - (0)' in 1527ms.
2023-10-11 22:20:45.276 [info] [Trace - 22:20:45] Sending notification 'initialized'.
2023-10-11 22:20:45.277 [info] [Trace - 22:20:45] Sending notification 'workspace/didChangeConfiguration'.
2023-10-11 22:20:45.361 [info] [Trace - 22:20:45] Received request 'client/registerCapability - (1)'.
2023-10-11 22:20:45.362 [info] [Trace - 22:20:45] Sending response 'client/registerCapability - (1)'. Processing request took 2ms
2023-10-11 22:20:45.362 [info] [Trace - 22:20:45] Sending notification 'textDocument/didOpen'.
2023-10-11 22:20:45.370 [info] [Trace - 22:20:45] Received request 'workspace/configuration - (2)'.
2023-10-11 22:20:45.371 [info] [Trace - 22:20:45] Sending response 'workspace/configuration - (2)'. Processing request took 0ms
2023-10-11 22:20:45.404 [info] [Trace - 22:20:45] Received request 'workspace/configuration - (3)'.
2023-10-11 22:20:45.404 [info] [Trace - 22:20:45] Sending response 'workspace/configuration - (3)'. Processing request took 1ms
2023-10-11 22:20:45.440 [info] [Trace - 22:20:45] Received request 'workspace/configuration - (4)'.
2023-10-11 22:20:45.440 [info] [Trace - 22:20:45] Sending response 'workspace/configuration - (4)'. Processing request took 1ms
2023-10-11 22:20:47.450 [info] [Trace - 22:20:47] Received notification 'window/logMessage'.
2023-10-11 22:20:47.450 [info] [Info  - 22:20:47] AvaloniaLanguageServer.Handlers.TextDocumentSyncHandler: ** DidOpenText: file:///home/gabriel/Projects/CSharp/HelloAvalonia/Hello%20Avalonia/MainWindow.axaml | Uri='file:///home/gabriel/Projects/CSharp/HelloAvalonia/Hello%20Avalonia/MainWindow.axaml'
2023-10-11 22:20:54.292 [info] Command avalonia.previewProcess, file:///home/gabriel/Projects/CSharp/HelloAvalonia/Hello%20Avalonia/MainWindow.axaml
2023-10-11 22:20:54.292 [info] PreviewServer.start /home/gabriel/Projects/CSharp/HelloAvalonia/Hello Avalonia/bin/Debug/net7.0/Hello Avalonia.dll
2023-10-11 22:20:54.301 [info] Previewer process started with args: exec,--runtimeconfig "/home/gabriel/Projects/CSharp/HelloAvalonia/Hello Avalonia/bin/Debug/net7.0/Hello Avalonia.runtimeconfig.json",--depsfile "/home/gabriel/Projects/CSharp/HelloAvalonia/Hello Avalonia/bin/Debug/net7.0/Hello Avalonia.deps.json" "/home/gabriel/.nuget/packages/avalonia/11.0.2/tools/netcoreapp2.0/designer/Avalonia.Designer.HostApp.dll",--method avalonia-remote,--transport tcp-bson://127.0.0.1:8001/,--method html,--html-url http://127.0.0.1:8000,"/home/gabriel/Projects/CSharp/HelloAvalonia/Hello Avalonia/bin/Debug/net7.0/Hello Avalonia.dll"
2023-10-11 22:20:54.301 [info] Preview server listening on port 8001
2023-10-11 22:20:54.303 [info] Show Preview to side: file:///home/gabriel/Projects/CSharp/HelloAvalonia/Hello%20Avalonia/MainWindow.axaml
2023-10-11 22:20:54.443 [info] Preview server connected on port 8001
2023-10-11 22:20:54.461 [info] Obtaining AppBuilder instance from Hello_Avalonia.Program

2023-10-11 22:20:54.478 [info] Initializing application in design mode

2023-10-11 22:20:54.527 [info] {"Uri":"http://127.0.0.1:8000/"}
2023-10-11 22:20:54.818 [info] Sending StartDesignerSessionMessage

2023-10-11 22:20:54.821 [info] {"SessionId":"c2b709f4-c47a-4bf9-a252-5f444c6ebb95"}
2023-10-11 22:20:54.821 [info] Start designer session message received.
2023-10-11 22:20:56.139 [info] {"Error":null,"Handle":null,"Exception":null}

Build project model for LSP

Build a project model from csproj and project folder
Currently the extension is optimised for development and using hard code project paths

Previews stopped working

Previews stopped working on windows & Linux, I'm currently encountering 2 different issues with them :

After clicking on the Build Project Button on a known working view, it does not seem to render anything and doesn't send an prompt the user with a notification stating the error.
The following logs could be found in the Avalonia Client Output tab :

[info] Command avalonia.previewProcess, file:///c%3A/Users/tinta/Documents/Repo/C%23/OTD/Plugins/0.5.x/Touch-Gestures/Touch-Gestures.UX/Views/MainView.axaml
[info] PreviewServer.start c:\Users\tinta\Documents\Repo\C#\OTD\Plugins\0.5.x\Touch-Gestures\Touch-Gestures.UX\bin\Debug\net7.0\Touch-Gestures.UX.dll
[info] Previewer process started with args: exec,--runtimeconfig "c:\Users\tinta\Documents\Repo\C#\OTD\Plugins\0.5.x\Touch-Gestures\Touch-Gestures.UX.Desktop\bin\Debug\net7.0\Touch-Gestures.UX.Desktop.runtimeconfig.json",--depsfile "c:\Users\tinta\Documents\Repo\C#\OTD\Plugins\0.5.x\Touch-Gestures\Touch-Gestures.UX.Desktop\bin\Debug\net7.0\Touch-Gestures.UX.Desktop.deps.json" "C:\Users\tinta\.nuget\packages\avalonia\11.0.4\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll",--method avalonia-remote,--transport tcp-bson://127.0.0.1:8001/,--method html,--html-url http://127.0.0.1:8000,"c:\Users\tinta\Documents\Repo\C#\OTD\Plugins\0.5.x\Touch-Gestures\Touch-Gestures.UX.Desktop\bin\Debug\net7.0\Touch-Gestures.UX.Desktop.dll"
[info] Preview server listening on port 8001
[info] Show Preview to side: file:///c%3A/Users/tinta/Documents/Repo/C%23/OTD/Plugins/0.5.x/Touch-Gestures/Touch-Gestures.UX/Views/MainView.axaml
[info] Preview server connected on port 8001
[info] Obtaining AppBuilder instance from TouchGestures.UX.Desktop.Program

[info] Initializing application in design mode

[info] {"Uri":"http://127.0.0.1:8000/"}
[info] Sending StartDesignerSessionMessage

[info] {"SessionId":"e0b8c3da-caeb-4115-b412-6b5e4593a3a5"}
[info] Start designer session message received.
[info] Unhandled exception. 
[info] System.Exception: Origin doesen't match Url
   at Avalonia.DesignerSupport.Remote.HtmlTransport.HtmlWebSocketTransport.AcceptWorker()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

[info] Preview server error: Error: read ECONNRESET
[info] Preview server closed for c:\Users\tinta\Documents\Repo\C#\OTD\Plugins\0.5.x\Touch-Gestures\Touch-Gestures.UX\bin\Debug\net7.0\Touch-Gestures.UX.dll
[info] Previewer process exited with code 3762504530

Here is the content of the DevTools, the following lines get spammed repeatedly :

[Extension Host] Preview server started on port 8001
{Warning} WebSocket connection to 'ws:<URL>/ws' failed: WebSocket is closed before the connection is established.
onPreviewUrlChanged http://127.0.0.1:8000
WebSocket connection to 'ws://127.0.0.1:8000/ws' failed: 
Connection error: [object Event]
onPreviewUrlChanged http://127.0.0.1:8000
Connection error: [object Event]
onPreviewUrlChanged http://127.0.0.1:8000
WebSocket connection to 'ws://127.0.0.1:8000/ws' failed: Insufficient resources

image


Another issue related to the preview function happen when attempting to preview a Templated control, result in absolutely nothing happening, the Build Project Button stays greyed out, and no errors are printed in the output :

[info] Command avalonia.previewProcess, file:///c%3A/Users/tinta/Documents/Repo/C%23/OTD/Plugins/0.5.x/Touch-Gestures/Touch-Gestures.UX/Controls/Containers/NodeCanvas.axaml
[info] Show Preview to side: file:///c%3A/Users/tinta/Documents/Repo/C%23/OTD/Plugins/0.5.x/Touch-Gestures/Touch-Gestures.UX/Controls/Containers/NodeCanvas.axaml
[info] Previewer assets generated at C:\Users\tinta\.nuget\packages\avalonia\11.0.4\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll
[info] Command avalonia.previewProcess, file:///c%3A/Users/tinta/Documents/Repo/C%23/OTD/Plugins/0.5.x/Touch-Gestures/Touch-Gestures.UX/Controls/Containers/NodeCanvas.axaml
[info] Show Preview to side: file:///c%3A/Users/tinta/Documents/Repo/C%23/OTD/Plugins/0.5.x/Touch-Gestures/Touch-Gestures.UX/Controls/Containers/NodeCanvas.axaml

Here is the content of the DevTools, and if anyone ask, yes, that's it, there it nothing else.

executing generateAssetsCommand

image

Code completion fails on brand new project

When you open a brand new avalonia project, the code completion fails
Users must build the project and reopen the VS Code fix it

2023-08-08 19:45:41.314 +05:30 [FTL] Failed to handle request textDocument/didOpen
System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\Users\prashantvc\source\repos\myapp\bin\Debug'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at AvaloniaLanguageServer.Models.ProjectInfo.AssemblyPath() in C:\Users\prashantvc\source\repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\ProjectInfo.cs:line 56
   at AvaloniaLanguageServer.Models.Workspace.<InitializeAsync>b__7_0() in C:\Users\prashantvc\source\repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\Workspace.cs:line 18
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at AvaloniaLanguageServer.Models.Workspace.InitializeAsync(DocumentUri uri) in C:\Users\prashantvc\source\repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\Workspace.cs:line 18
   at AvaloniaLanguageServer.Handlers.TextDocumentSyncHandler.Handle(DidOpenTextDocumentParams request, CancellationToken cancellationToken) in C:\Users\prashantvc\source\repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Handlers\TextDocumentSyncHandler.cs:line 27
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteNotification>g__InnerRoute|6_0(IServiceScopeFactory serviceScopeFactory, TDescriptor descriptor, Object params, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteNotification(IRequestDescriptor`1 descriptors, Notification notification, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass11_0.<<RouteNotification>b__3>d.MoveNext()

AXAML intellisense in VS Code broken

Since update of Avalonia for VS Code (0.0.22) code completion in AXAML is no longer working.
Update to VS Code 1.84.0 won't fix.
Downgrade to Avalonia to 0.0.21 doesn't fix.

Previewer is not available

Running under macOS. The extension loads fine (see attached picture), and the XAML code completion works fine. However, the previewer is not available for AXAML files.

The project is Avalonia 11.0.4 it's fully built. I tried restarting Visual Studio Code and had no luck.
Screenshot 2023-09-04 at 13 18 39

Not sure if related, but every time I open VSCode I get:

Downloading the .NET Runtime.
AvaloniaTeam.vscode-avalonia wants to install .NET 7.0.10 but it already exists. No downloads or changes were made.

permission denied

run vscode withe wsl and develop avalonia

2023-09-27 18:54:57.630 [info] Command avalonia.previewProcess, file:///mnt/e/Users/Heartacker/QSync/WSL_Share/Avalonia/AvaloniaDemo/AvaloniaDemo2/Views/MainWindow.axaml
2023-09-27 18:54:57.630 [info] Previewer process already started: 3930
2023-09-27 18:54:57.631 [info] Show Preview to side: file:///mnt/e/Users/Heartacker/QSync/WSL_Share/Avalonia/AvaloniaDemo/AvaloniaDemo2/Views/MainWindow.axaml
2023-09-27 18:54:58.651 [info] {"Error":"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.\n ---> System.TypeInitializationException: The type initializer for 'Avalonia.Diagnostics.Conventions' threw an exception.\n ---> System.UnauthorizedAccessException: Access to the path '/mnt/d/Program Files/Microsoft VS Code/Screenshots' is denied.\n ---> System.IO.IOException: Permission denied\n   --- End of inner exception stack trace ---\n   at System.IO.FileSystem.CreateDirectory(String fullPath, UnixFileMode unixCreateMode)\n   at System.IO.Directory.CreateDirectory(String path)\n   at Avalonia.Diagnostics.Conventions.get_DefaultScreenshotsRoot()\n   at Avalonia.Diagnostics.Screenshots.FilePickerHandler..ctor(String title, String screenshotRoot)\n   at Avalonia.Diagnostics.Screenshots.FilePickerHandler..ctor()\n   at Avalonia.Diagnostics.Conventions..cctor()\n   --- End of inner exception stack trace ---\n   at Avalonia.Diagnostics.Conventions.get_DefaultScreenshotHandler()\n   at Avalonia.Diagnostics.DevToolsOptions..ctor()\n   at Avalonia.DevToolsExtensions.AttachDevTools(TopLevel root)\n   at AvaloniaDemo2.Views.MainWindow.InitializeComponent(Boolean loadXaml, Boolean attachDevTools) in /mnt/e/Users/Heartacker/QSync/WSL_Share/Avalonia/AvaloniaDemo/AvaloniaDemo2/Avalonia.Generators/Avalonia.Generators.NameGenerator.AvaloniaNameSourceGenerator/AvaloniaDemo2.Views.MainWindow.g.cs:line 29\n   at AvaloniaDemo2.Views.MainWindow..ctor() in /mnt/e/Users/Heartacker/QSync/WSL_Share/Avalonia/AvaloniaDemo/AvaloniaDemo2/Views/MainWindow.axaml.cs:line 9\n   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)\n   --- End of inner exception stack trace ---\n   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)\n   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadOrPopulate(Type created, Object rootInstance, IServiceProvider parentServiceProvider)\n   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.<>c.<LoadGroupSreCore>b__15_2(ValueTuple`2 t)\n   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()\n   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadGroupSreCore(IReadOnlyCollection`1 documents, RuntimeXamlLoaderConfiguration configuration)\n   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)\n   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)\n   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)\n   at Avalonia.Designer.HostApp.DesignXamlLoader.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)\n   at Avalonia.DesignerSupport.DesignWindowLoader.LoadDesignerWindow(String xaml, String assemblyPath, String xamlFileProjectPath, Double renderScaling)\n   at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.<>c__DisplayClass18_0.<OnTransportMessage>b__0()","Handle":null,"Exception":{"ExceptionType":"TypeInitializationException","Message":"The type initializer for 'Avalonia.Diagnostics.Conventions' threw an exception.","LineNumber":null,"LinePosition":null}}

Building the preview is stuck in loading state

I'm unable to preview, it is stuck in building.
image

Using: VS Code Insiders, tried on version 0.0.22 & 0.0.21 both are a problem
My machine I'm using is: Lenovo IdeaPad Pro 5 16IRH8 83AQ004NMB Azerty
Windows installed.

.NET Runtime 7.0.10 installation

I have .NET Runtime 7.0.10 available on my machine but this extension is still trying to download and install it, and eventually timeout.
image

Implement `axaml` previewer

As a Avalonia user on VS Code I should be able to preview my XAML code in real time.

Prerequisites:

  • Workspace must have an Avalonia executable project, ie. Exe or WinExe
  • User must have at least one active XAML file open in the workspace to enable previewer

Features:

Feature Request: per profile installation

Avalonia extension as of now doesn't support installation per VS Code profile, instead it installs to default profile.
One must apply extension to all profiles to have in .net workload.
in the picture below it's actually installed through .net profile, but after shuffling between default than back to .net it disappeared
image

Extenstion not activating

For some reason the extension is not even activating, i can't open the preview panel and i can't use XAMl intellisense. in the extension tab i found this:
image

I tried restarting vscode a couple of times now with no luck, i am using Fedora.

Previewer Window Title will not update

Type: Bug

The previewer window title doesn't update on switching between active AXAML files

image

Extension version: 0.0.18
VS Code version: Code 1.82.0 (Universal) (8b617bd08fd9e3fc94d14adb8d358b56e3f72314, 2023-09-06T22:09:41.364Z)
OS version: Darwin arm64 23.0.0
Modes:

Extension fails to launch child process if VS Code path has spaces

2023-09-05 22:43:09.681 [info] [EXT - INFO] Solution data path path: C:\Users\ALEXRN~1\AppData\Local\Temp\tests.sln.json
2023-09-05 22:43:10.247 [info] parser process args: C:\WINDOWS\system32\cmd.exe,/d,/s,/c,"dotnet c:\Users\Alex Rønne Petersen\.vscode\extensions\avaloniateam.vscode-avalonia-0.0.17\solutionParserTool\SolutionParser.dll z:\Source\tests\tests.sln"
2023-09-05 22:43:10.345 [info] Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-c:\Users\Alex does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

2023-09-05 22:43:10.356 [info] parser process exited 1

(Note the second bullet point there.)

Please publish this extension to the Open VSX

Dear extension author, please publish this extension to the Open VSX marketplace.

Due to Microsoft's licensing restrictions, the majority of VS Code-derived products, such as Gitpod, Theia-based IDEs, and so forth, are unable to utilize Microsoft's Extensions Marketplace.

Therefore, it's important to also publish to OpenVSX, a vendor-neutral alternative to Microsoft's Extensions Marketplace, so that developers who use these versions of VS Code can find extensions like this one.

You can read on about Open VSX at the Eclipse Foundation's Open VSX FAQ.

The docs to publish an extension can be found here. This process is straightforward and shouldn't take too long. Essentially, you need an authentication token and to execute the ovsx publish command to publish your extension. There's also a doc explaining the whole process with an example GitHub Action workflow.

Mouse interaction is broken in the previewer

Type: Bug

Interactions with the previewer does not work. The mouse position is offset

Extension version: 0.0.19
VS Code version: Code 1.83.0 (Universal) (e7e037083ff4455cf320e344325dacb480062c3c, 2023-10-03T16:13:15.449Z)
OS version: Darwin arm64 23.0.0
Modes:

First!

Type: Bug

Testing the report issue dialog

Extension version: 0.0.5
VS Code version: Code - Insiders 1.81.0-insider (Universal) (862fa13002d8018c328931ee1edccfd4ca76447d, 2023-07-26T05:36:43.574Z)
OS version: Darwin arm64 23.0.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 3, 3
Memory (System) 32.00GB (2.95GB free)
Process Argv --crash-reporter-id 0dca3b99-dd0e-424d-97cc-4be51f2678a5
Screen Reader no
VM 0%
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vsdfh931:30280409
vshan820:30294714
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
py29gd2263:30784851
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
2i9eh265:30646982
showlangstatbar:30737417
7ij38806:30687742
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30771523
hideindicator:30766887
pythongtdpath:30726887
i26e3531:30792625
gsofa:30797620
pythonnosmt12:30779711
pythonidxpt:30768918
pythonnoceb:30776497
copilotsettingt:30767686
e537b577:30772214
h0f32768:30792099
asynctok:30795849
dsvsc013:30777762
dsvsc014:30777825
cmakesidepanelv2:30779593
diffeditorv2:30786206

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.