-
Notifications
You must be signed in to change notification settings - Fork 237
Delete projects we wont be keeping around and get pses.vscode working again #1046
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
Changes from 1 commit
9095ebd
cfb31ca
65b0077
fb7245c
e1ba479
b511511
6da984c
9e1d413
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,22 +22,23 @@ public class NewVSCodeHtmlContentViewCommand : PSCmdlet | |
|
||
private ILogger _logger; | ||
|
||
private ViewColumn? _showInColumn; | ||
|
||
/// | ||
[Parameter(Mandatory = true, Position = 0)] | ||
[ValidateNotNullOrEmpty] | ||
public string Title { get; set; } | ||
|
||
/// | ||
[Parameter(Position = 1)] | ||
public ViewColumn? ShowInColumn { get; set; } | ||
|
||
/// | ||
protected override void BeginProcessing() | ||
public ViewColumn ShowInColumn | ||
{ | ||
get => _showInColumn.GetValueOrDefault(); | ||
set => _showInColumn = value; | ||
} | ||
|
||
/// | ||
protected override void ProcessRecord() | ||
protected override void BeginProcessing() | ||
{ | ||
if (_htmlContentViewsFeature == null) | ||
{ | ||
|
@@ -53,25 +54,27 @@ protected override void ProcessRecord() | |
} | ||
else | ||
{ | ||
throw new Exception("unable to fetch psEditor value"); | ||
WriteError( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this is a non-terminating error. Would it be better as a terminating error, since not being able to find the PSEditor object we won't be able to proceed meaningfully? Terminating here wouldn't kill a script, just a pipeline, so it would operate with the desired effect I think. ThrowTerminatingError(
new ErrorRecord(
new ItemNotFoundException("Cannot find the '$psEditor' variable"),
"PSEditorNotFound",
ErrorCategory.ObjectNotFound,
targetObject: null));
return; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that makes sense. Updated! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't kill the script, but in general I prefer non-terminating because that lets the user easily handle errors with the I don't feel particularly strongly about not using terminating in this particular case though, just adding some more information. |
||
new ErrorRecord( | ||
new ItemNotFoundException("Cannot find a variable with the name 'psEditor'."), | ||
"PSEditorNotFound", | ||
ErrorCategory.ObjectNotFound, | ||
targetObject: null)); | ||
|
||
return; | ||
} | ||
} | ||
|
||
IHtmlContentView view = _htmlContentViewsFeature.CreateHtmlContentViewAsync(Title) | ||
.GetAwaiter() | ||
.GetResult(); | ||
|
||
if (ShowInColumn != null) { | ||
view.Show(ShowInColumn.Value).GetAwaiter().GetResult(); | ||
if (_showInColumn != null) { | ||
view.Show(_showInColumn.Value).GetAwaiter().GetResult(); | ||
} | ||
|
||
WriteObject(view); | ||
} | ||
|
||
/// | ||
protected override void EndProcessing() | ||
{ | ||
} | ||
} | ||
|
||
/// | ||
|
@@ -100,23 +103,13 @@ public class SetVSCodeHtmlContentViewCommand : PSCmdlet | |
|
||
/// | ||
protected override void BeginProcessing() | ||
TylerLeonhardt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
} | ||
|
||
/// | ||
protected override void ProcessRecord() | ||
{ | ||
var htmlContent = new HtmlContent(); | ||
htmlContent.BodyContent = HtmlBodyContent; | ||
htmlContent.JavaScriptPaths = JavaScriptPaths; | ||
htmlContent.StyleSheetPaths = StyleSheetPaths; | ||
HtmlContentView.SetContentAsync(htmlContent).GetAwaiter().GetResult(); | ||
} | ||
|
||
/// | ||
protected override void EndProcessing() | ||
{ | ||
} | ||
} | ||
|
||
/// | ||
|
@@ -131,19 +124,9 @@ public class CloseVSCodeHtmlContentViewCommand : PSCmdlet | |
|
||
/// | ||
protected override void BeginProcessing() | ||
TylerLeonhardt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
} | ||
|
||
/// | ||
protected override void ProcessRecord() | ||
{ | ||
HtmlContentView.Close().GetAwaiter().GetResult(); | ||
} | ||
|
||
/// | ||
protected override void EndProcessing() | ||
{ | ||
} | ||
} | ||
|
||
/// | ||
|
@@ -164,19 +147,9 @@ public class ShowVSCodeHtmlContentViewCommand : PSCmdlet | |
|
||
/// | ||
protected override void BeginProcessing() | ||
TylerLeonhardt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
} | ||
|
||
/// | ||
protected override void ProcessRecord() | ||
{ | ||
HtmlContentView.Show(ViewColumn).GetAwaiter().GetResult(); | ||
} | ||
|
||
/// | ||
protected override void EndProcessing() | ||
{ | ||
} | ||
} | ||
|
||
/// | ||
|
@@ -195,20 +168,10 @@ public class WriteVSCodeHtmlContentViewCommand : PSCmdlet | |
[ValidateNotNull] | ||
public string AppendedHtmlBodyContent { get; set; } | ||
|
||
/// | ||
protected override void BeginProcessing() | ||
{ | ||
} | ||
|
||
/// | ||
protected override void ProcessRecord() | ||
{ | ||
HtmlContentView.AppendContentAsync(AppendedHtmlBodyContent).GetAwaiter().GetResult(); | ||
} | ||
|
||
/// | ||
protected override void EndProcessing() | ||
{ | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.