mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-08 02:50:42 +00:00
fix(nvim): intelephense license loading
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
-- These are my utility functions
|
-- These are my utility functions
|
||||||
-- I use to make my life bit easier
|
-- I use to make my life bit easier
|
||||||
|
|
||||||
|
local function file_exists(name)
|
||||||
|
if type(name) ~= 'string' then return false end
|
||||||
|
return os.rename(name, name) and true or false
|
||||||
|
end
|
||||||
|
|
||||||
-- ╭─────────────────────────────────────────────────────────╮
|
-- ╭─────────────────────────────────────────────────────────╮
|
||||||
-- │ Function shortcuts for keymap set │
|
-- │ Function shortcuts for keymap set │
|
||||||
-- ╰─────────────────────────────────────────────────────────╯
|
-- ╰─────────────────────────────────────────────────────────╯
|
||||||
@@ -88,8 +93,11 @@ function ToggleBackground() vim.o.bg = vim.o.bg == 'light' and 'dark' or 'light'
|
|||||||
-- Get the license key for intelephense
|
-- Get the license key for intelephense
|
||||||
---@return string|nil -- The license key for intelephense
|
---@return string|nil -- The license key for intelephense
|
||||||
function GetIntelephenseLicense()
|
function GetIntelephenseLicense()
|
||||||
local f =
|
local p = os.getenv 'HOME' .. '/intelephense/license.txt'
|
||||||
assert(io.open(os.getenv 'HOME' .. '/intelephense/license.txt', 'rb'))
|
|
||||||
|
if not file_exists(p) then return nil end
|
||||||
|
|
||||||
|
local f = assert(io.open(p, 'rb'))
|
||||||
local content = f:read '*a'
|
local content = f:read '*a'
|
||||||
f:close()
|
f:close()
|
||||||
return string.gsub(content, '%s+', '')[1] or nil
|
return string.gsub(content, '%s+', '')[1] or nil
|
||||||
|
|||||||
Reference in New Issue
Block a user