mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-15 21:37:09 +09:00
Add linter option
This commit is contained in:
@@ -218,7 +218,6 @@ func main() {
|
|||||||
|
|
||||||
L.SetGlobal("OS", luar.New(L, runtime.GOOS))
|
L.SetGlobal("OS", luar.New(L, runtime.GOOS))
|
||||||
L.SetGlobal("view", luar.New(L, view))
|
L.SetGlobal("view", luar.New(L, view))
|
||||||
L.SetGlobal("settings", luar.New(L, &settings))
|
|
||||||
L.SetGlobal("messenger", luar.New(L, messenger))
|
L.SetGlobal("messenger", luar.New(L, messenger))
|
||||||
L.SetGlobal("GetOption", luar.New(L, GetOption))
|
L.SetGlobal("GetOption", luar.New(L, GetOption))
|
||||||
L.SetGlobal("AddOption", luar.New(L, AddOption))
|
L.SetGlobal("AddOption", luar.New(L, AddOption))
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -406,6 +406,13 @@ func (v *View) ClearGutterMessages(section string) {
|
|||||||
v.messages[section] = []GutterMessage{}
|
v.messages[section] = []GutterMessage{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearAllGutterMessages clears all the gutter messages
|
||||||
|
func (v *View) ClearAllGutterMessages() {
|
||||||
|
for k := range v.messages {
|
||||||
|
v.messages[k] = []GutterMessage{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DisplayView renders the view to the screen
|
// DisplayView renders the view to the screen
|
||||||
func (v *View) DisplayView() {
|
func (v *View) DisplayView() {
|
||||||
// The character number of the character in the top left of the screen
|
// The character number of the character in the top left of the screen
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ function go_onSave()
|
|||||||
go_gofmt()
|
go_gofmt()
|
||||||
end
|
end
|
||||||
|
|
||||||
linter_lint("go build", "go build -o /dev/null 2>&1", "%f:%l: %m")
|
|
||||||
linter_lint("go lint", "golint " .. view.Buf.Path, "%f:%l:%d+: %m")
|
|
||||||
|
|
||||||
view:ReOpen()
|
view:ReOpen()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
if GetOption("linter") == nil then
|
||||||
|
AddOption("linter", true)
|
||||||
|
end
|
||||||
|
|
||||||
function linter_onSave()
|
function linter_onSave()
|
||||||
|
if GetOption("linter") then
|
||||||
local ft = view.Buf.Filetype
|
local ft = view.Buf.Filetype
|
||||||
local file = view.Buf.Path
|
local file = view.Buf.Path
|
||||||
local devnull = "/dev/null"
|
local devnull = "/dev/null"
|
||||||
@@ -21,6 +26,9 @@ function linter_onSave()
|
|||||||
elseif ft == "JavaScript" then
|
elseif ft == "JavaScript" then
|
||||||
linter_lint("jshint", "jshint " .. file, "%f: line %l,.+, %m")
|
linter_lint("jshint", "jshint " .. file, "%f: line %l,.+, %m")
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
view:ClearAllGutterMessages()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function linter_lint(linter, cmd, errorformat)
|
function linter_lint(linter, cmd, errorformat)
|
||||||
|
|||||||
Reference in New Issue
Block a user