Lua type definitions for osm2pgsql flex config designed for the Lua Language Server.
This provides completion, hover docs, and diagnostics for the osm2pgsql Lua API when writing style scripts.
library/osm2pgsql.luatype annotations for the public osm2pgsql Lua API.config.jsonLuaLS addon config to register theosm2pgsqlglobal.
Clone the repo and point LuaLS at it.
Option A: use the addon config (recommended).
{
"Lua.workspace.userThirdParty": ["/path/to/osm2pgsql-lua-definitions"]
}Option B: add the library folder directly.
{
"Lua.workspace.library": ["/path/to/osm2pgsql-lua-definitions/library"]
}Restart the language server after updating settings.
local roads = osm2pgsql.define_table({
name = "roads",
ids = { type = "way", id_column = "osm_id" },
columns = {
{ column = "name", type = "text" },
{ column = "geom", type = "linestring" },
},
})
function osm2pgsql.process_way(object)
if object.tags.highway then
roads:insert({
name = object.tags.name,
geom = object:as_linestring(),
})
end
endMIT. See LICENSE.