Skip to content

Commit c9d4056

Browse files
authored
Merge pull request #61 from ember-cli/revert
Revert "Open editor on clicking compilation error"
2 parents a061439 + f45295a commit c9d4056

7 files changed

Lines changed: 449 additions & 820 deletions

File tree

lib/templates/error.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,7 @@
10991099
<article class="content">
11001100
<h1 class="error-header">Dang! Looks like a {{errorType}}.</h1>
11011101
{{#if location.file}}
1102-
<h2 class="error-message" onclick="openEditorForTemplateError()">
1103-
{{location.file}}{{#if location.line}}:{{location.line}}{{/if}}
1104-
</h2>
1102+
<h2 class="error-message">{{location.file}}{{#if location.line}}:{{location.line}}{{/if}}</h2>
11051103
{{/if}}
11061104

11071105
{{#if codeFrame}}
@@ -1142,12 +1140,5 @@ <h2>Environment</h2>
11421140
<span>{{versionString}}</span>
11431141
</article>
11441142
</main>
1145-
<script>
1146-
function openEditorForTemplateError() {
1147-
let xhr = new XMLHttpRequest();
1148-
xhr.open('GET', '/ember_open_editor_for_template_compilation_error', true);
1149-
xhr.send();
1150-
}
1151-
</script>
11521143
</body>
11531144
</html>

lib/utils/filename-normaliser.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

lib/watcher-middleware.js

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
const url = require('url');
44
const path = require('path');
5-
const launchEditor = require('launch-editor');
65

76
const errorHandler = require('./utils/error-handler');
8-
const { getNormalisedFileName } = require('./utils/filename-normaliser');
97

108
module.exports = function watcherMiddleware(watcher, options) {
119
options = options || {};
@@ -36,49 +34,10 @@ module.exports = function watcherMiddleware(watcher, options) {
3634

3735
next();
3836
}, (buildError) => {
39-
if (request.url === '/ember_open_editor_for_template_compilation_error') {
40-
let errorLocation = buildError.broccoliPayload.error.location || {};
41-
let { originalError } = buildError.broccoliPayload;
42-
if (originalError) {
43-
let originalLocation = originalError.loc || originalError.location || {};
44-
errorLocation.line = originalLocation.line || errorLocation.line || 1;
45-
errorLocation.column = originalLocation.column || errorLocation.column || 1;
46-
}
47-
48-
let {
49-
file: fileName,
50-
line,
51-
column
52-
} = errorLocation;
53-
54-
if (fileName) {
55-
let normalisedFileName = getNormalisedFileName(fileName, line, column);
56-
57-
// 1) If the EMBER_CLI_EDITOR is set, it's value will be used as the editor.
58-
// 2) If EMBER_CLI_EDITOR is not set, launchEditor will try to guess which editor is open.
59-
// a) If it succeeds, that guessed editor will be opened.
60-
// b) Else, it will fall back to VISUAL and EDITOR.
61-
// 3) If none of these work, it will display a message asking the user to set EMBER_CLI_EDITOR
62-
let emberCliEditor = process.env.EMBER_CLI_EDITOR;
63-
64-
launchEditor(normalisedFileName, emberCliEditor, () => {
65-
if (!emberCliEditor) {
66-
console.log(
67-
'To set up the editor integration, set the env variable EMBER_CLI_EDITOR ' +
68-
'to an editor of your choice and restart the server.'
69-
);
70-
}
71-
});
72-
}
73-
74-
response.writeHead(200);
75-
response.end();
76-
} else {
77-
errorHandler(response, {
78-
'buildError': buildError,
79-
'liveReloadPath': options.liveReloadPath
80-
});
81-
}
37+
errorHandler(response, {
38+
'buildError': buildError,
39+
'liveReloadPath': options.liveReloadPath
40+
});
8241
})
8342
.catch((err) => {
8443
console.log(err);

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
},
2525
"dependencies": {
2626
"ansi-html": "^0.0.9",
27-
"find-up": "^3.0.0",
2827
"handlebars": "^4.0.4",
2928
"has-ansi": "^3.0.0",
30-
"launch-editor": "^2.2.1",
3129
"mime-types": "^2.1.18"
3230
},
3331
"devDependencies": {

pnpm-lock.yaml

Lines changed: 0 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)