From 4f7fba8fa2043b0e014bff0fa4bf91b89c267911 Mon Sep 17 00:00:00 2001 From: Marin Minnerly Date: Fri, 19 Jan 2024 13:45:11 -0800 Subject: [PATCH] Get analysis passing for plugin and server --- .justfile | 6 ++-- plugin/src/components/ThemeDetailsWrapper.lua | 16 +++++------ plugin/src/createUrl.lua | 28 +++++++++++-------- plugin/src/types.lua | 6 ++-- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.justfile b/.justfile index 681a168..58697a5 100644 --- a/.justfile +++ b/.justfile @@ -96,12 +96,14 @@ plugin-analyze: --defs={{ global_defs_path }} \ --defs={{ testez_defs_path }} \ --settings="./.vscode/settings.json" \ - --ignore=**/_Index/** \ + --ignore=**/Packages/** \ {{ plugin_source }} server-analyze: rojo sourcemap {{ server_project }} -o {{ sourcemap_path }} - luau-lsp analyze --sourcemap={{ sourcemap_path }} server/src/ + luau-lsp analyze --sourcemap={{ sourcemap_path }} \ + --settings="./.vscode/settings.json" \ + {{ server_source }} analyze: just plugin-analyze diff --git a/plugin/src/components/ThemeDetailsWrapper.lua b/plugin/src/components/ThemeDetailsWrapper.lua index 2a05082..ae13d11 100644 --- a/plugin/src/components/ThemeDetailsWrapper.lua +++ b/plugin/src/components/ThemeDetailsWrapper.lua @@ -1,12 +1,10 @@ -local Root = script:FindFirstAncestor("Swatch") - -local React = require(Root.Packages.React) -local Sift = require(Root.Packages.Sift) -local styles = require(script.Parent.styles) -local LoadingSpinner = require(script.Parent.LoadingSpinner) -local ThemeDetails = require(script.Parent.ThemeDetails) -local fetchExtensionThemes = require(script.Parent.Parent.fetchExtensionThemes) -local types = require(script.Parent.Parent.types) +local React = require("@pkg/React") +local Sift = require("@pkg/Sift") +local styles = require("./styles") +local LoadingSpinner = require("./LoadingSpinner") +local ThemeDetails = require("./ThemeDetails") +local fetchExtensionThemes = require("@root/fetchExtensionThemes") +local types = require("@root/types") local useState = React.useState local useEffect = React.useEffect diff --git a/plugin/src/createUrl.lua b/plugin/src/createUrl.lua index d3db9f1..0d529f0 100644 --- a/plugin/src/createUrl.lua +++ b/plugin/src/createUrl.lua @@ -1,20 +1,24 @@ local HttpService = game:GetService("HttpService") -local function createUrl(baseUrl: string, query: { [string]: any }) - local joinedQuery = "" - for key, value in query do - if typeof(value) == "table" then - value = HttpService:JSONEncode(value) - else - value = tostring(value) +local function createUrl(baseUrl: string, query: { [string]: any }?) + if query then + local joinedQuery = "" + for key, value in query do + if typeof(value) == "table" then + value = HttpService:JSONEncode(value) + else + value = tostring(value) + end + joinedQuery ..= `{key}={value}&` end - joinedQuery ..= `{key}={value}&` - end - -- Remove the last ampersand (&) from the query string - joinedQuery = joinedQuery:gsub("&$", "") + -- Remove the last ampersand (&) from the query string + joinedQuery = joinedQuery:gsub("&$", "") - return ("%s?%s"):format(baseUrl, joinedQuery) + return `{baseUrl}?joinedQuery` + else + return baseUrl + end end return createUrl diff --git a/plugin/src/types.lua b/plugin/src/types.lua index e743d95..4760e12 100644 --- a/plugin/src/types.lua +++ b/plugin/src/types.lua @@ -189,10 +189,12 @@ type TokenColor = { export type ExtensionTheme = { colors: { [string]: string }, - name: string, tokenColors: { TokenColor }, + + name: string?, + uuid: string?, semanticHighlighting: boolean?, type: string?, } -return nil +return {}