Fixed schemacompanion lualine
This commit is contained in:
@@ -5,11 +5,20 @@ local function get_schema()
|
|||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local schema = (require("schema-companion").get_current_schemas() or "none")
|
-- The provided get_current_schema function returns nonenil when no schema is known.
|
||||||
if schema == "none" then
|
-- Instead we use a custom implemention that does not do that.
|
||||||
|
-- Also has the added benefit of giving more control over formatting
|
||||||
|
local schemas = require("schema-companion").get_matching_schemas()
|
||||||
|
if schemas == nil or #schemas == 0 then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
return schema
|
|
||||||
|
schema = schemas[1]
|
||||||
|
if schema.name == "none" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return ("%s%s"):format(schema.name, #schemas > 1 and (" (+%d)"):format(#schemas - 1) or "")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @module "lazy"
|
--- @module "lazy"
|
||||||
|
|||||||
Reference in New Issue
Block a user