()
| 149 | |
| 150 | |
| 151 | componentDidMount() { |
| 152 | const path = window.require('path'); |
| 153 | const fs = window.require('fs'); |
| 154 | var file = fs.readFileSync(this.props.path, { encoding: 'utf8' }); |
| 155 | // initialize editor |
| 156 | this.editor = monaco.editor.create(document.getElementById('editor-container'), |
| 157 | { |
| 158 | language: this._getLanguage(this.props.path), |
| 159 | theme: 'ayu-dark', |
| 160 | lineNumbers: 'on', |
| 161 | wordWrap: 'on', |
| 162 | scrollBeyondLastLine: false, |
| 163 | automaticLayout: true, |
| 164 | glyphMargin: true |
| 165 | |
| 166 | }, |
| 167 | |
| 168 | ); |
| 169 | |
| 170 | |
| 171 | // Intialize the linter |
| 172 | this._linterWorker = new ESLintWorker(); |
| 173 | this._linterWorker.addEventListener('message', (message) => { this._updateMarkers(message); }); |
| 174 | |
| 175 | this._openFile(this.props.path); |
| 176 | |
| 177 | } |
| 178 | |
| 179 | componentDidUpdate(prevProps) { |
| 180 | const { path/*, ...rest*/ } = this.props; |
nothing calls this directly
no test coverage detected