Skip to content

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

Closed
Matthew Burleigh (mburleigh) wants to merge 6 commits into
microsoft:masterfrom
mburleigh:master
Closed

Add option to open command results in a new tab#47
Matthew Burleigh (mburleigh) wants to merge 6 commits into
microsoft:masterfrom
mburleigh:master

Conversation

@mburleigh

Copy link
Copy Markdown
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

Microsoft Contribution License Agreements (msftclas) commented Mar 15, 2019

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

add status bar item to RunLineInEditor class
add execution timing to RunLineInEditor class
@mburleigh

Copy link
Copy Markdown
Contributor Author

Chris Dias (@chrisdias) Christof Marti (@chrmarti) is there anything I can do to move this PR along?

@chrmarti Christof Marti (chrmarti) added this to the Mai 2019 milestone May 20, 2019
@chrmarti

Copy link
Copy Markdown
Contributor

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

@chrmarti Christof Marti (chrmarti) left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/extension.ts
Comment thread src/extension.ts
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
Copy Markdown
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.

Comment thread src/extension.ts
Comment thread src/extension.ts
function replaceContent(editor: TextEditor, content: string) {
function replaceContent(editor: TextEditor, content: string, documentLanguage: string = '') {
const document = editor.document;
if (documentLanguage) {

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor

Closing this PR as you split out separate ones.

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