Unverified Commit 4d5159fe authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #2763 from ethereum/fixSolMode

Better file type extraction
parents 958ecca3 a293d5c4
......@@ -243,13 +243,11 @@ class Editor extends Plugin {
* @param {string} path Path of the file
*/
_getMode (path) {
let ext = path.indexOf('.') !== -1 ? /[^.]+/.exec(path) : null
if (ext) {
ext = path.replace(ext[0] + '.', '') // we get <ext>
} else ext = 'txt'
ext = ext.split('#')
if (!ext.length) return this.modes['txt']
ext = ext[0]
if (!path) return this.modes['txt']
const root = path.split('#')[0].split('?')[0]
let ext = root.indexOf('.') !== -1 ? /[^.]+$/.exec(root) : null
if (ext) ext = ext[0]
else ext = 'txt'
return ext && this.modes[ext] ? this.modes[ext] : this.modes['txt']
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment