Skip to content
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

Set language when opening new editor #82

Merged
merged 4 commits into from
Mar 21, 2017
Merged

Conversation

d-akara
Copy link
Contributor

@d-akara d-akara commented Mar 19, 2017

The new feature is working great. Thanks!
After using this for a bit, I found a couple of things that improve my work.

  1. I set the language automatically when opening a new editor. I wanted to do this also for reusing the same editor, but I couldn't find an API to do it.
  2. Included request url and elapsed time in the response document
  3. Made the response information into comments which makes it play nice with the language theme and coloring.

Hopefully you can consider these changes. Thanks!

add request and timing info into response document
make response info into comments
@Huachao
Copy link
Owner

Huachao commented Mar 20, 2017

@dakaraphi the code LGTM. However, I still want to discuss with you that do we give user the flexibility that user can view the response in http language and not commented headers and request url?

@d-akara
Copy link
Contributor Author

d-akara commented Mar 20, 2017

@Huachao so are you simply asking to provide a user preference setting?
Something like rest-client.previewResponseSetUntitledDocumentLanguageByContentType

  • default false: Will work as it did without my changes
  • true: will attempt to set language and make header info comments

I added 2 additional pieces of information. The request url and response time. Do you want that included when in http format or only when language can be set?

@Huachao
Copy link
Owner

Huachao commented Mar 20, 2017

@dakaraphi that's what I mean, what do you think about it? And thanks for your PR

@d-akara
Copy link
Contributor Author

d-akara commented Mar 20, 2017

@Huachao I added 2 new preferences. Let me know what you think.
For now, I have them both set as default false.

I do think setting the language adds a lot of power and makes the experience richer.

  1. I can now use my theme created for custom coloring in response
  2. I can now use all language feature extensions like JSON query or XML Xpath directly on the response. This is pretty cool.

If vscode resolves microsoft/vscode#1800 it will make it even better :-)

html: '<!-- ',
css: '/* '
}
return commentStyle[language] ? commentStyle[language] + REST_RESPONSE: '';
Copy link
Owner

Choose a reason for hiding this comment

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

add a space before :

package.json Outdated
"rest-client.includeAdditionalInfoInResponse": {
"type": "boolean",
"default": false,
"description": "Include additional information such as request URL and response time"
Copy link
Owner

Choose a reason for hiding this comment

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

also indicate that this only works when previewing response in untitled document

@Huachao Huachao merged commit afa6309 into Huachao:master Mar 21, 2017
@Huachao
Copy link
Owner

Huachao commented Mar 21, 2017

@dakaraphi Merged, I will publish this change in next release. Thanks for your contribution 😄

@d-akara d-akara deleted the AutoLanguage branch April 5, 2017 21:49
@Download
Copy link

microsoft/vscode#1800 looks resolved.

@Huachao
Copy link
Owner

Huachao commented Oct 24, 2018

@Download @dakaraphi thanks, I've changed to use the latest setTextDocumentLanguage API.

@Huachao
Copy link
Owner

Huachao commented Nov 1, 2018

@Download @dakaraphi I have published the new version 0.20.3 with this new setTextDocumentLanguage API

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.

3 participants