Browse Source

Fix editorconfig error

pull/15/head
10sr 8 years ago
parent
commit
e1bcfb8983
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      micro/init.lua

+ 4
- 4
micro/init.lua View File

@@ -57,13 +57,13 @@ local function applyProperties(properties, view)
end end


function onEditorConfigExit(output) function onEditorConfigExit(output)
-- FIXME: messege when editorconfig exit with error
local properties = {} local properties = {}
-- TODO: Which is better? output:gmatch(), string.gmatch(output, ...)
for line in output:gmatch('([^\n]+)') do for line in output:gmatch('([^\n]+)') do
-- TODO: Fix regex
-- TODO: Throw error for invalid output
local key, value = line:match('([^=]*)=(.*)') local key, value = line:match('([^=]*)=(.*)')
if key == nil or value == nil then
messenger:Message("Failed to parse editorconfig output: " .. output)
return
end
key = key:gsub('^%s(.-)%s*$', '%1') key = key:gsub('^%s(.-)%s*$', '%1')
value = value:gsub('^%s(.-)%s*$', '%1') value = value:gsub('^%s(.-)%s*$', '%1')
properties[key] = value properties[key] = value


Loading…
Cancel
Save