Skip to content

Use DataModel analysis #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

- name: Generate sourcemap for LSP
shell: bash
run: rojo sourcemap dev.project.json -o sourcemap.json
run: rojo sourcemap tests.project.json -o sourcemap.json

- name: Analyze
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"luau-lsp.sourcemap.rojoProjectFile": "tests.project.json"
}
2 changes: 1 addition & 1 deletion bin/analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

curl -s -O https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/master/scripts/globalTypes.d.lua

rojo sourcemap dev.project.json -o sourcemap.json
rojo sourcemap tests.project.json -o sourcemap.json

luau-lsp analyze --sourcemap=sourcemap.json --defs=globalTypes.d.lua --defs=testez.d.lua --ignore=**/_Index/** src/

Expand Down
2 changes: 1 addition & 1 deletion src/Components/ComponentTree/Component/Directory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
local function Directory(props: Props)
local theme = useTheme()
local hover, setHover = React.useState(false)
local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if hover then 0 else 1,
rotation = if props.expanded then 90 else 0,
config = constants.SPRING_CONFIG,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ComponentTree/Component/Story.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
local function Story(props: Props)
local theme = useTheme()
local hover, setHover = React.useState(false)
local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if not props.active then if hover then 0 else 1 else 0,
color = if not props.active then theme.divider else theme.selection,
textColor = if not props.active then theme.textFaded else theme.background,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/DragHandle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local function DragHandle(props: Props)
local plugin = React.useContext(PluginContext.Context)
local isDragging, setIsDragging = React.useState(false)
local isHovered, setIsHovered = React.useState(false)
local mouseInput: InputObject, setMouseInput = React.useState(nil)
local mouseInput, setMouseInput = React.useState(nil :: InputObject?)

local getHandleProperties = React.useCallback(function()
local size: UDim2
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Navbar/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local function Item(props: Props)
local theme = useTheme()

local hover, setHover = React.useState(false)
local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if not props.active and hover then 0 else 1,
config = constants.SPRING_CONFIG,
})
Expand Down
10 changes: 8 additions & 2 deletions src/Components/ResizablePanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ local function ResizablePanel(props: Props)
end, { absoluteSize })

local isWidthResizable = React.useMemo(function()
return Sift.Array.includes(props.dragHandles, "Left") or Sift.Array.includes(props.dragHandles, "Right")
if props.dragHandles then
return Sift.Array.includes(props.dragHandles, "Left") or Sift.Array.includes(props.dragHandles, "Right")
end
return nil
end, { props.dragHandles })

local isHeightResizable = React.useMemo(function()
return Sift.Array.includes(props.dragHandles, "Top") or Sift.Array.includes(props.dragHandles, "Bottom")
if props.dragHandles then
return Sift.Array.includes(props.dragHandles, "Top") or Sift.Array.includes(props.dragHandles, "Bottom")
end
return nil
end, { props.dragHandles })

local width = React.useMemo(function()
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Searchbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local function Searchbar(props: Props)
local isFocused, setIsFocused = React.useState(false)
local isExpanded = isFocused or search ~= ""

local styles = RoactSpring.useSpring({
local styles = (RoactSpring.useSpring :: any)({
alpha = if isExpanded then 1 else 0,
config = constants.SPRING_CONFIG,
})
Expand Down
2 changes: 1 addition & 1 deletion src/Components/StoryView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local function StoryView(props: Props)
local extraControls, setExtraControls = React.useState({})
local controlsHeight, setControlsHeight = React.useState(constants.CONTROLS_INITIAL_HEIGHT)
local topbarHeight, setTopbarHeight = React.useState(0)
local storyParentRef = React.useRef()
local storyParentRef = React.useRef(nil :: GuiObject?)
local controls

if story and story.controls then
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/PluginContext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local flipbook = script:FindFirstAncestor("flipbook")

local React = require(flipbook.Packages.React)

local PluginContext = React.createContext()
local PluginContext = React.createContext(nil :: Plugin?)

export type Props = {
plugin: Plugin,
Expand Down