Skip to content

Commit

Permalink
feat: sync other kinds of fflags
Browse files Browse the repository at this point in the history
  • Loading branch information
lopi-py committed Sep 29, 2024
1 parent 6fb7bf3 commit 0793629
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ require("luau-lsp").setup {
fflags = {
sync = true, -- sync currently enabled fflags with roblox's published fflags
override = {
LuauTarjanChildLimit = 0,
LuauSolverV2 = "True", -- enable the new solver
},
},
}
Expand Down
20 changes: 8 additions & 12 deletions lua/luau-lsp/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local util = require "luau-lsp.util"

local CURRENT_FFLAGS_URL =
"https://clientsettingscdn.roblox.com/v1/settings/application?applicationName=PCDesktopClient"
local FFLAG_KINDS = { "FFlag", "FInt", "DFFlag", "DFInt" }

---@type integer[]
local pending_buffers = {}
Expand Down Expand Up @@ -37,18 +38,13 @@ local function get_fflags()
local fflags = {}

if config.get().fflags.sync then
vim
.iter(fetch_fflags())
:filter(function(name)
return name:match "^FFlagLuau"
end)
:map(function(name, value)
---@diagnostic disable-next-line: redundant-return-value
return name:sub(6), value
end)
:each(function(name, value)
fflags[name] = value
end)
for name, value in pairs(fetch_fflags()) do
for _, kind in ipairs(FFLAG_KINDS) do
if vim.startswith(name, kind .. "Luau") then
fflags[name:sub(#kind + 1)] = value
end
end
end
end

return vim.tbl_deep_extend("force", fflags, config.get().fflags.override)
Expand Down

0 comments on commit 0793629

Please sign in to comment.