-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Debug] Add new ExternalTypeResolver
- Loading branch information
1 parent
ecdeb31
commit e3f8e43
Showing
16 changed files
with
218 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.IO.Pipes; | ||
using Mono.Debugging.Client; | ||
using StreamJsonRpc; | ||
|
||
namespace DotNet.Meteor.Debug; | ||
|
||
public class ExternalTypeResolver : IDisposable { | ||
private readonly NamedPipeClientStream? transportStream; | ||
private JsonRpc? rpcServer; | ||
|
||
public ExternalTypeResolver(string? transportId) { | ||
if (!string.IsNullOrEmpty(transportId)) | ||
transportStream = new NamedPipeClientStream(".", transportId, PipeDirection.InOut, PipeOptions.Asynchronous); | ||
} | ||
|
||
public bool TryConnect(int timeoutMs = 5000) { | ||
if (transportStream == null) | ||
return false; | ||
|
||
try { | ||
transportStream.Connect(timeoutMs); | ||
rpcServer = JsonRpc.Attach(transportStream); | ||
DebuggerLoggingService.CustomLogger.LogMessage("Debugger connected to external type resolver"); | ||
} catch (Exception e) { | ||
DebuggerLoggingService.CustomLogger.LogMessage($"Failed to connect to external type resolver: {e}"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
public string? Resolve(string identifierName, SourceLocation location) { | ||
return rpcServer?.InvokeAsync<string>("HandleResolveType", identifierName, location)?.Result; | ||
} | ||
|
||
public void Dispose() { | ||
rpcServer?.Dispose(); | ||
transportStream?.Dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as res from '../resources/constants'; | ||
import * as vscode from 'vscode'; | ||
|
||
export class ExternalTypeResolver { | ||
public static feature : ExternalTypeResolver = new ExternalTypeResolver(); | ||
public transportId: string | undefined; | ||
|
||
public async activate(context: vscode.ExtensionContext): Promise<void> { | ||
const dotrushExtension = vscode.extensions.getExtension(res.dotrushExtensionId); | ||
if (!dotrushExtension) | ||
return; | ||
|
||
this.transportId = `dotrush-${process.pid}`; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.