-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
open-in-editor #483
open-in-editor #483
Conversation
@@ -39,6 +39,7 @@ | |||
"css-loader": "^0.28.7", | |||
"eslint": "^4.13.1", | |||
"eslint-plugin-vue-libs": "^2.0.1", | |||
"express-open-in-editor": "^3.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we using the express middleware instead of open-in-editor
itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to be used in the webpack-dev-server directly (that uses an express server).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this would not work when installed as an extension, since there will be no devServer running... |
It needs some change to the user webpack config yes. We can't open the file from the extension anyway. |
I don't think that's a downer, that's reasonable and can be documented. I would include it in the webpack template asap. :) |
onTitleClick () { | ||
const file = this.target.file | ||
if (file) { | ||
fetch(`/_open?file=${file}`).then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this will be making a request from the origin of the extension and only works during dev - however we should be able to initiate the request from the inspected window by doing an eval like in inspectDOM
!
I've done some testing and the implementation with nuxt is really very simple.
// nuxt.config.js
const openInEditor = require('express-open-in-editor')
module.exports = {
...
serverMiddleware: [
{
path: '/_open',
handler: openInEditor({
editor: 'code',
})
}
]
} or if you want to use something less verbose you can install the nuxt-open-in-editor module.
// nuxt.config.js
module.exports = {
...
modules: [
'nuxt-open-in-editor'
]
} |
@atinux Shouldn't this work out-of-the-box with https://github.com/nuxt/nuxt.js/blob/9b8cbed51236d32372706be7c2381df032c3dd88/lib/core/renderer.js#L227-L249? |
Actually it's @pi0 whom implemented it, but yeah it should work out-of-the-box with Nuxt.js directly. |
Basically, Nuxt should also work as our middleware is using exactly same query param ( If it's going to be a standard endpoint, I would suggest using something like |
The new
|
BREAKING CHANGE: endpoint changed ref: vuejs/devtools-v6#483
upgrade @nuxtjs/youch to 4.0.0 ref: vuejs/devtools-v6#483
Updated to |
For this to work, user webpack config needs to be modified. Example: https://github.com/vuejs/vue-devtools/pull/483/files#diff-b4cdb7abeacb810177ac96ccfd26094a (supported editors)
This should work with Nuxt out-of-the-box (using the same
/_open
route).