Skip to content

Commit

Permalink
Merge pull request #37 from puremourning/c-sharp-samsung
Browse files Browse the repository at this point in the history
C sharp samsung
  • Loading branch information
mergify[bot] authored Jun 23, 2019
2 parents 3b854a8 + a4db700 commit 1473e9d
Show file tree
Hide file tree
Showing 13 changed files with 969 additions and 25 deletions.
72 changes: 60 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ of hackery that makes it challenging to support generally. These languages are
on a best-efforts basis:

- Java (see caveats)
- C# (c-sharp) using dotnet core

## Languages known not to work

- C# (c-sharp) using mono debug adapter (vimspector unable to set breakpoints)

## Other languages

Expand Down Expand Up @@ -145,12 +150,14 @@ RHEL 7.6.

The debug adapters themselves have certain runtime dependencies:

| Language | Switch | Adapter | Dependencies |
|--------------|-------------------|-------------------|------------------------|
| C, C++, etc. | `--enable-c` | vscode-cpptools | mono-core |
| Python | `--enable-python` | vscode-python | Python 2.7 or Python 3 |
| TCL | `--enable-tcl` | tclpro | TCL 8.5 |
| Bourne Shell | `--enable-bash` | vscode-bash-debug | Bash v?? |
| Language | Status | Switch | Adapter | Dependencies |
|------------------|--------------|------------------------------|-------------------|------------------------|
| C, C++, etc. | Supported | `--all` or ` --enable-c` | vscode-cpptools | mono-core |
| Python | Supported | `--all` or `--enable-python` | vscode-python | Python 2.7 or Python 3 |
| TCL | Experimental | `--all` or `--enable-tcl` | tclpro | TCL 8.5 |
| Bourne Shell | Experimental | `--all` or `--enable-bash` | vscode-bash-debug | Bash v?? |
| C# (dotnet core) | Experimental | `--force-enable-csharp` | netcoredbg | DotNet core |
| C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono |

For other languages, you'll need some other way to install the gadget.

Expand Down Expand Up @@ -525,6 +532,53 @@ Example `.vimspector.json`

See [my fork of TclProDebug](https://github.com/puremourning/TclProDebug) for instructions.

* C# - dotnet core

Requires `install_gadget.py --force-enable-c-sharp`

```json
{
"configurations": {
"launch - netcoredbg": {
"adapter": "netcoredbg",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.2/csharp.dll",
"args": [],
"stopAtEntry": true
}
}
}
}
```

* C# - mono

Requires `install_gadget.py --force-enable-c-sharp`.

***Known not to work.****

```json
{
"configurations": {
"launch - mono": {
"adapter": "vscode-mono-debug",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.2/csharp.dll",
"args": [],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "mono",
"runtimeArgs": [],
"env": [],
"externalConsole": false,
"console": "integratedTerminal"
}
}
}
}
```

Also the mock debugger, but that isn't actually useful.

## Partially supported
Expand All @@ -538,12 +592,6 @@ Also the mock debugger, but that isn't actually useful.
on which it is listening. See [this issue](https://github.com/puremourning/vimspector/issues/3)
for more background.

## Unsupported

Known not to work:
* C-sharp. The license appears to require that it is only used with Visual
Studio Code.

# FAQ

1. Q: Does it work? A: Yeah, sort of. It's _incredibly_ buggy and unpolished.
Expand Down
82 changes: 71 additions & 11 deletions install_gadget.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,42 @@
},
'do': lambda name, root: InstallTclProDebug( name, root )
},
'netcoredbg': {
'language': 'csharp',
'enabled': False,
'download': {
'url': ( 'https://github.com/Samsung/netcoredbg/releases/download/latest/'
'${file_name}' ),
'format': 'tar',
},
'all': {
'version': 'master'
},
'macos': {
'file_name': 'netcoredbg-osx-master.tar.gz',
'checksum': '',
},
'linux': {
'file_name': 'netcoredbg-linux-master.tar.gz',
'checksum': '',
},
'do': lambda name, root: MakeSymlink( gadget_dir,
name,
os.path.join( root, 'netcoredbg' ) ),
'adapters': {
'netcoredbg': {
"name": "netcoredbg",
"command": [
"${gadgetDir}/netcoredbg/netcoredbg",
"--interpreter=vscode"
],
"attach": {
"pidProperty": "processId",
"pidSelect": "ask"
},
},
}
},
'vscode-mono-debug': {
'language': 'csharp',
'enabled': False,
Expand All @@ -121,6 +157,18 @@
'version': '0.15.8',
'checksum':
'723eb2b621b99d65a24f215cb64b45f5fe694105613a900a03c859a62a810470',
},
'adapters': {
'vscode-mono-debug': {
"name": "mono-debug",
"command": [
"mono",
"${gadgetDir}/vscode-mono-debug/bin/Release/mono-debug.exe"
],
"attach": {
"pidSelect": "none"
},
},
}
},
'vscode-bash-debug': {
Expand Down Expand Up @@ -338,36 +386,48 @@ def CloneRepoTo( url, ref, destination ):
action = 'store_true',
help = 'Enable all completers' )

done_languages = set()
for name, gadget in GADGETS.items():
lang = gadget[ 'language' ]
if lang in done_languages:
continue

done_languages.add( lang )
if not gadget.get( 'enabled', True ):
parser.add_argument(
'--force-enable-' + lang,
action = 'store_true',
help = 'Install the unsupported {} debug adapter for {} support'.format(
name,
lang ) )
continue

parser.add_argument(
'--enable-' + gadget[ 'language' ],
'--enable-' + lang,
action = 'store_true',
help = 'Install the {} debug adapter for {} support'.format(
name,
gadget[ 'language' ] ) )
lang ) )

parser.add_argument(
'--disable-' + gadget[ 'language' ],
'--disable-' + lang,
action = 'store_true',
help = 'Don\t install the {} debug adapter for {} support '
'(when supplying --all)'.format( name, gadget[ 'language' ] ) )
'(when supplying --all)'.format( name, lang ) )

args = parser.parse_args()

failed = []
all_adapters = {}
for name, gadget in GADGETS.items():
if not gadget.get( 'enabled', True ):
continue

if not args.all and not getattr( args, 'enable_' + gadget[ 'language' ] ):
continue

if getattr( args, 'disable_' + gadget[ 'language' ] ):
continue
if not getattr( args, 'force_enable_' + gadget[ 'language' ] ):
continue
else:
if not args.all and not getattr( args, 'enable_' + gadget[ 'language' ] ):
continue
if getattr( args, 'disable_' + gadget[ 'language' ] ):
continue

try:
v = {}
Expand Down
2 changes: 1 addition & 1 deletion python3/vimspector/debug_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def _LoadThreadsIfReady( self ):
self._stackTraceView.LoadThreads( True )


def OnEvent_capabiilities( self, msg ):
def OnEvent_capabilities( self, msg ):
self._server_capabilities.update(
( msg.get( 'body' ) or {} ).get( 'capabilities' ) or {} )

Expand Down
2 changes: 1 addition & 1 deletion python3/vimspector/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def scopes_consumer( message ):
old_scopes[ i ][ 'name' ] == scope[ 'name' ] ):
scope[ '_expanded' ] = old_scopes[ i ].get( '_expanded', False )
scope[ '_old_variables' ] = old_scopes[ i ].get( '_variables', [] )
elif not scope[ 'expensive' ]:
elif not scope.get( 'expensive' ):
# Expand any non-expensive scope unless manually collapsed
scope[ '_expanded' ] = True

Expand Down
2 changes: 2 additions & 0 deletions support/test/csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
obj/Debug
21 changes: 21 additions & 0 deletions support/test/csharp/.vimspector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"configurations": {
"launch - netcoredbg": {
"adapter": "netcoredbg",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.2/csharp.dll",
"args": [],
"stopAtEntry": true
}
},
"launch - mono": {
"adapter": "vscode-mono-debug",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/Program.exe"
}
}
}
}

12 changes: 12 additions & 0 deletions support/test/csharp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace csharp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
8 changes: 8 additions & 0 deletions support/test/csharp/csharp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

</Project>
18 changes: 18 additions & 0 deletions support/test/csharp/csharp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
5 changes: 5 additions & 0 deletions support/test/csharp/obj/csharp.csproj.nuget.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": 1,
"dgSpecHash": "6/vdr7YprlSIoQecv/nNuLNflFpO0X7eN7jHUinZTsgian9nYpmHMWirsDWMi5l+29TH+Qy8O/QfaB/48QtjRQ==",
"success": true
}
18 changes: 18 additions & 0 deletions support/test/csharp/obj/csharp.csproj.nuget.g.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/Users/ben/.vim/bundle/vimspector/support/test/csharp/obj/project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/ben/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/ben/.nuget/packages/;/usr/local/share/dotnet/sdk/NuGetFallbackFolder</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.9.4</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.props" Condition="Exists('/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.props')" />
</ImportGroup>
</Project>
10 changes: 10 additions & 0 deletions support/test/csharp/obj/csharp.csproj.nuget.g.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="/usr/local/share/dotnet/sdk/NuGetFallbackFolder/netstandard.library/2.0.3/build/netstandard2.0/NETStandard.Library.targets" Condition="Exists('/usr/local/share/dotnet/sdk/NuGetFallbackFolder/netstandard.library/2.0.3/build/netstandard2.0/NETStandard.Library.targets')" />
<Import Project="/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.targets" Condition="Exists('/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.targets')" />
</ImportGroup>
</Project>
Loading

0 comments on commit 1473e9d

Please sign in to comment.