|
2 | 2 |
|
3 | 3 | const url = require('url'); |
4 | 4 | const path = require('path'); |
5 | | -const launchEditor = require('launch-editor'); |
6 | 5 |
|
7 | 6 | const errorHandler = require('./utils/error-handler'); |
8 | | -const { getNormalisedFileName } = require('./utils/filename-normaliser'); |
9 | 7 |
|
10 | 8 | module.exports = function watcherMiddleware(watcher, options) { |
11 | 9 | options = options || {}; |
@@ -36,49 +34,10 @@ module.exports = function watcherMiddleware(watcher, options) { |
36 | 34 |
|
37 | 35 | next(); |
38 | 36 | }, (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 | + }); |
82 | 41 | }) |
83 | 42 | .catch((err) => { |
84 | 43 | console.log(err); |
|
0 commit comments