Skip to content

Commit

Permalink
DataModel gives better analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
vocksel committed Nov 25, 2023
1 parent 14b803b commit 35db621
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 10 deletions.
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({})

export type Props = {
plugin: Plugin,
Expand Down

0 comments on commit 35db621

Please sign in to comment.