Skip to content

Commit

Permalink
Merge pull request #108 from WildernessLabs/alexischr-MigrateVS2022Ex…
Browse files Browse the repository at this point in the history
…tensionTov2

Migrate VSCode extension to CLI v2
  • Loading branch information
adrianstevens authored Jan 10, 2025
2 parents 2508a42 + 87090df commit 039357c
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 155 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: VSCode Extension
env:
IDE_TOOLS_RELEASE_VERSION: 1.9.7
IDE_TOOLS_RELEASE_VERSION: 2.0.0

on:
push:
Expand All @@ -18,40 +18,47 @@ jobs:

steps:
- name: Checkout current repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main
submodules: true

- if: ${{ github.ref == 'refs/heads/main' }}
name: Checkout Meadow.CLI.Core side-by-side
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: WildernessLabs/Meadow.CLI
path: Meadow.CLI
ref: main

- if: ${{ github.ref != 'refs/heads/main' }}
name: Checkout Meadow.CLI.Core side-by-side
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: WildernessLabs/Meadow.CLI
path: Meadow.CLI
ref: develop

- name: Checkout Meadow.Contracts side-by-side
uses: actions/checkout@v4
with:
repository: WildernessLabs/Meadow.Contracts
path: Meadow.Contracts
ref: main

- name: Setup .NET 8.0.x
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Setup Nuget
uses: Nuget/setup-nuget@v1.0.5
uses: Nuget/setup-nuget@v2

- name: Setup Node.js 16
uses: actions/setup-node@v3
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Install vsce
run: |
Expand Down Expand Up @@ -93,14 +100,14 @@ jobs:
vsce package
- name: Upload VSIX Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: VSCodeMeadow.vsix.${{ ENV.IDE_TOOLS_RELEASE_VERSION }}
path: 'main/*.vsix'

- name: Upload Binlog Artifacts
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: BinLogs
path: '**/*.binlog'
Expand Down
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "meadow",
"displayName": "VSCode Tools For Meadow",
"version": "1.9.7",
"version": "2.0.0",
"publisher": "WildernessLabs",
"description": "Build, Debug and Deploy Meadow applications",
"icon": "meadow.png",
Expand Down Expand Up @@ -63,7 +63,6 @@
"activationEvents": [
"onStartupFinished",
"onDebug",
"onCommand:extension.meadow.configureExceptions",
"onCommand:extension.meadow.startSession"
],
"contributes": {
Expand Down
49 changes: 35 additions & 14 deletions src/VSCodeMeadow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "debugger", "debugger", "{DD
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meadow", "Meadow", "{639FE3D4-9D7F-4823-9911-48FE49C6998F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.Hcom.6.0.0", "..\..\Meadow.CLI\Meadow.Hcom\Meadow.Hcom.6.0.0.csproj", "{5F0219BE-F626-4C90-89B0-202850AE43C5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.CLI.Core.6.0.0", "..\..\Meadow.CLI\Meadow.CLI.Core\Meadow.CLI.Core.6.0.0.csproj", "{21E7E61E-D9CE-48E2-B1DA-52B5FC12015A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VSCodeMeadow", "csharp\VSCodeMeadow.csproj", "{D46A8779-DAE7-4B90-ACBA-08893A504193}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Debugging", "..\externals\debugger-libs\Mono.Debugging\Mono.Debugging.csproj", "{CD6FED13-1984-4491-97AB-1A4361E1F582}"
Expand All @@ -18,20 +14,22 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Debugger.Soft", "..\ex
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Debugging.Soft", "..\externals\debugger-libs\Mono.Debugging.Soft\Mono.Debugging.Soft.csproj", "{7592E68B-CE43-4433-8B5A-F7890BAA2ABC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meadow.HCom", "..\..\Meadow.CLI\Source\v2\Meadow.HCom\Meadow.HCom.csproj", "{7F1115C6-5081-4997-AC0F-789D95B5092C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meadow.Tooling.Core", "..\..\Meadow.CLI\Source\v2\Meadow.Tooling.Core\Meadow.Tooling.Core.csproj", "{AF35343B-B97C-4300-9EB4-DE753CADDC13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meadow.Linker", "..\..\Meadow.CLI\Source\v2\Meadow.Linker\Meadow.Linker.csproj", "{B11B8D26-FE98-4BD7-875E-D5A0801D3415}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meadow.SoftwareManager", "..\..\Meadow.CLI\Source\v2\Meadow.SoftwareManager\Meadow.SoftwareManager.csproj", "{CC5D6AA6-F58A-4B8B-A514-988BCAEA21EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meadow.Cloud.Client", "..\..\Meadow.CLI\Source\v2\Meadow.Cloud.Client\Meadow.Cloud.Client.csproj", "{7820644F-8B87-4864-81B4-A8CB5859A71C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5F0219BE-F626-4C90-89B0-202850AE43C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F0219BE-F626-4C90-89B0-202850AE43C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F0219BE-F626-4C90-89B0-202850AE43C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F0219BE-F626-4C90-89B0-202850AE43C5}.Release|Any CPU.Build.0 = Release|Any CPU
{21E7E61E-D9CE-48E2-B1DA-52B5FC12015A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21E7E61E-D9CE-48E2-B1DA-52B5FC12015A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21E7E61E-D9CE-48E2-B1DA-52B5FC12015A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21E7E61E-D9CE-48E2-B1DA-52B5FC12015A}.Release|Any CPU.Build.0 = Release|Any CPU
{D46A8779-DAE7-4B90-ACBA-08893A504193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D46A8779-DAE7-4B90-ACBA-08893A504193}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D46A8779-DAE7-4B90-ACBA-08893A504193}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -48,16 +46,39 @@ Global
{7592E68B-CE43-4433-8B5A-F7890BAA2ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7592E68B-CE43-4433-8B5A-F7890BAA2ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7592E68B-CE43-4433-8B5A-F7890BAA2ABC}.Release|Any CPU.Build.0 = Release|Any CPU
{7F1115C6-5081-4997-AC0F-789D95B5092C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F1115C6-5081-4997-AC0F-789D95B5092C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F1115C6-5081-4997-AC0F-789D95B5092C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F1115C6-5081-4997-AC0F-789D95B5092C}.Release|Any CPU.Build.0 = Release|Any CPU
{AF35343B-B97C-4300-9EB4-DE753CADDC13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF35343B-B97C-4300-9EB4-DE753CADDC13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF35343B-B97C-4300-9EB4-DE753CADDC13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF35343B-B97C-4300-9EB4-DE753CADDC13}.Release|Any CPU.Build.0 = Release|Any CPU
{B11B8D26-FE98-4BD7-875E-D5A0801D3415}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B11B8D26-FE98-4BD7-875E-D5A0801D3415}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B11B8D26-FE98-4BD7-875E-D5A0801D3415}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B11B8D26-FE98-4BD7-875E-D5A0801D3415}.Release|Any CPU.Build.0 = Release|Any CPU
{CC5D6AA6-F58A-4B8B-A514-988BCAEA21EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC5D6AA6-F58A-4B8B-A514-988BCAEA21EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC5D6AA6-F58A-4B8B-A514-988BCAEA21EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC5D6AA6-F58A-4B8B-A514-988BCAEA21EE}.Release|Any CPU.Build.0 = Release|Any CPU
{7820644F-8B87-4864-81B4-A8CB5859A71C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7820644F-8B87-4864-81B4-A8CB5859A71C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7820644F-8B87-4864-81B4-A8CB5859A71C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7820644F-8B87-4864-81B4-A8CB5859A71C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5F0219BE-F626-4C90-89B0-202850AE43C5} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
{21E7E61E-D9CE-48E2-B1DA-52B5FC12015A} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
{CD6FED13-1984-4491-97AB-1A4361E1F582} = {DD5D7FCB-5097-433E-8399-BB037883FB2F}
{8D8752AF-06C6-40CE-AA55-B454DD6808E1} = {DD5D7FCB-5097-433E-8399-BB037883FB2F}
{7592E68B-CE43-4433-8B5A-F7890BAA2ABC} = {DD5D7FCB-5097-433E-8399-BB037883FB2F}
{7F1115C6-5081-4997-AC0F-789D95B5092C} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
{AF35343B-B97C-4300-9EB4-DE753CADDC13} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
{B11B8D26-FE98-4BD7-875E-D5A0801D3415} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
{CC5D6AA6-F58A-4B8B-A514-988BCAEA21EE} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
{7820644F-8B87-4864-81B4-A8CB5859A71C} = {639FE3D4-9D7F-4823-9911-48FE49C6998F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C0062C7F-7F87-41DC-9A63-BE15C14E7A43}
Expand Down
10 changes: 10 additions & 0 deletions src/csharp/DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ public MeadowOutputEvent(string outpt)
{ }
}

public class UpdateProgressBarEvent : Event
{
public UpdateProgressBarEvent(string fileName, uint percent)
: base("updateProgressBar", new {
filename = fileName,
percentage = percent
})
{
}
}
// ---- Response -------------------------------------------------------------------------

public class Capabilities : ResponseBody {
Expand Down
34 changes: 30 additions & 4 deletions src/csharp/Meadow/DebugSessionLogger.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;

namespace VsCodeMeadowUtil
{
public class DebugSessionLogger : ILogger
{
string previousFileName = string.Empty;
uint previousPercentage = 0;

public DebugSessionLogger(Action<string> callback)
{
Callback = callback;
Expand All @@ -20,13 +24,35 @@ public bool IsEnabled(LogLevel logLevel)
if (System.Diagnostics.Debugger.IsAttached)
return true;

return logLevel == LogLevel.Information;
return logLevel >= LogLevel.Information;
}

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
if (logLevel == LogLevel.Information || logLevel == LogLevel.Error || logLevel == LogLevel.Warning)
Callback?.Invoke(formatter(state, exception)?.Trim());
if (IsEnabled(logLevel))
{
Callback?.Invoke(formatter(state, exception));
}
}

internal async Task ReportDeviceMessage(string source, string message)
{
this.LogInformation($"{source}: {message}");
}

internal async Task ReportFileProgress(string fileName, uint percentage)
{
if (percentage > 0
&& percentage > 99)
{
if (!previousFileName.Equals(fileName)
|| !previousPercentage.Equals(percentage))
{
this.LogInformation($"{percentage}% of '{fileName}' Sent");
previousFileName = fileName;
previousPercentage = percentage;
}
}
}
}
}
}
Loading

0 comments on commit 039357c

Please sign in to comment.