Skip to content

Add option to open command results in a new tab#47

Closed
mburleigh wants to merge 6 commits intomicrosoft:masterfrom
mburleigh:master
Closed

Add option to open command results in a new tab#47
mburleigh wants to merge 6 commits intomicrosoft:masterfrom
mburleigh:master

Conversation

@mburleigh
Copy link
Contributor

The Rest Client extension (https://marketplace.visualstudio.com/items?itemName=humao.rest-client) has functionality like this and after using the Azure CLI Tools extension for a while I missed being able to have the results of multiple commands available. This will open a new results tab every time "Run Line in Editor" is executed.

@msftclas
Copy link

msftclas commented Mar 15, 2019

CLA assistant check
All CLA requirements met.

add status bar item to RunLineInEditor class
add execution timing to RunLineInEditor class
@mburleigh
Copy link
Contributor Author

@chrisdias @chrmarti is there anything I can do to move this PR along?

@chrmarti chrmarti added this to the Mai 2019 milestone May 20, 2019
@chrmarti
Copy link
Contributor

@mburleigh Sorry, we were heads-down into another part of the VS Code project. I'll take a look.

Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I have added a few comments.

this.query = undefined; // TODO
const cursor = source.selection.active;
const line = source.document.lineAt(cursor).text;
const isPlainText = (line.indexOf('--query') !== -1) || (line.indexOf('-h') !== -1) || (line.indexOf('--help') !== -1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do this in a separate PR? And maybe check the output if it starts and ends with {} or [] to assume it is JSON. That would handle more cases.

function replaceContent(editor: TextEditor, content: string) {
function replaceContent(editor: TextEditor, content: string, documentLanguage: string = '') {
const document = editor.document;
if (documentLanguage) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to always update because in the case where the document is reused, it might receive JSON again after plain text.

@chrmarti chrmarti removed this from the Mai 2019 milestone Jun 24, 2019
@mburleigh mburleigh mentioned this pull request Jun 24, 2019
@chrmarti
Copy link
Contributor

Closing this PR as you split out separate ones.

@chrmarti chrmarti closed this Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants