Skip to content

Commit

Permalink
fix: 0.9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tris203 committed May 24, 2024
1 parent 716f113 commit e29b2d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions lua/precognition/compat.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local M = {}

function M.inlay_hints_enabled(t)
if vim.lsp and vim.lsp.inlay_hint and vim.lsp.inlay_hint.is_enabled then
return vim.lsp.inlay_hint.is_enabled(t)
end
return false
end

return M
7 changes: 4 additions & 3 deletions lua/precognition/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local hm = require("precognition.horizontal_motions")
local vm = require("precognition.vertical_motions")
local utils = require("precognition.utils")
local compat = require("precognition.compat")

local M = {}

Expand Down Expand Up @@ -89,13 +90,13 @@ local config = default
---@type integer?
local extmark -- the active extmark in the current buffer
---@type boolean
local dirty -- whether a redraw is needed
local dirty -- whether a redraw is needed
---@type boolean
local visible = false
---@type string
local gutter_name_prefix = "precognition_gutter_" -- prefix for gutter signs object naame
---@type {SupportedGutterHints: { line: integer, id: integer }} -- cache for gutter signs
local gutter_signs_cache = {} -- cache for gutter signs
local gutter_signs_cache = {} -- cache for gutter signs

---@type integer
local au = vim.api.nvim_create_augroup("precognition", { clear = true })
Expand Down Expand Up @@ -146,7 +147,7 @@ local function build_virt_line(marks, line_num, line_len)
return {}
end

if vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }) then
if compat.inlay_hints_enabled({ bufnr = 0 }) then
local inlays_hints = vim.lsp.inlay_hint.get({
bufnr = 0,
range = {
Expand Down

0 comments on commit e29b2d3

Please sign in to comment.