feat: Add Global Data Block recognition in workspace scope

- Add db_parser.lua to parse .db files (DATA_BLOCK with VAR sections)
- Update workspace_types.lua to scan for .db files in project
- Update blink_cmp_source.lua to provide DB auto-completion:
  - DB names available in general completion (without quotes)
  - Type quote to get DB members
  - Multi-level nested member access support
- Add DB count to workspace commands
- Update README with Global DB documentation
This commit is contained in:
2026-02-17 15:06:36 +01:00
parent a3ea6e6c0a
commit 7db896b84c
5 changed files with 759 additions and 11 deletions
+8 -2
View File
@@ -138,27 +138,33 @@ function M.show_workspace_types()
local ws = require("scl.workspace_types")
local udt = require("scl.udt_parser")
local fb = require("scl.fb_parser")
local db = require("scl.db_parser")
local root = ws.get_project_root()
local udt_names = udt.get_all_udt_names()
local fb_names = fb.get_all_fb_names()
local db_names = db.get_all_db_names()
if not root then
vim.notify("No project root detected", vim.log.levels.WARN)
return
end
vim.notify("Project: " .. root .. "\nUDTs: " .. #udt_names .. "\nFBs/Functions: " .. #fb_names, vim.log.levels.INFO)
vim.notify("Project: " .. root .. "\nUDTs: " .. #udt_names .. "\nFBs/Functions: " .. #fb_names .. "\nGlobal DBs: " .. #db_names, vim.log.levels.INFO)
end
function M.rescan_workspace_types()
local ws = require("scl.workspace_types")
local udt = require("scl.udt_parser")
local fb = require("scl.fb_parser")
local db = require("scl.db_parser")
udt.clear_cache()
fb.clear_cache()
db.clear_cache()
ws.clear_root_cache()
local udt_result = ws.scan_project_udts()
local fb_result = ws.scan_project_fbs()
local db_result = ws.scan_project_dbs()
vim.notify("Scanned UDTs: " .. udt_result.parsed_count .. "/" .. udt_result.total_files ..
", FBs: " .. fb_result.parsed_count .. "/" .. fb_result.total_files, vim.log.levels.INFO)
", FBs: " .. fb_result.parsed_count .. "/" .. fb_result.total_files ..
", DBs: " .. db_result.parsed_count .. "/" .. db_result.total_files, vim.log.levels.INFO)
end
function M.create_commands()