Skip to content
This repository has been archived by the owner on Jun 12, 2022. It is now read-only.

Commit

Permalink
Fix types not using type index
Browse files Browse the repository at this point in the history
Remove need for Objects and Function type
Fixes JohnnyMorganz/luau-lsp#23
  • Loading branch information
JohnnyMorganz committed Jun 9, 2022
1 parent 6ed1441 commit 9644c05
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 137 deletions.
11 changes: 2 additions & 9 deletions dumpRobloxTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
TYPE_INDEX = {
"Tuple": "any",
"Variant": "any",
"Function": "(any) -> (any)",
"function": "(any) -> (any)",
"Function": "<A..., R...>(A...) -> R...",
"function": "<A..., R...>(A...) -> R...",
"bool": "boolean",
"int": "number",
"int64": "number",
Expand All @@ -40,7 +40,6 @@
"Array": "{ any }",
"table": "{ any }",
"CoordinateFrame": "CFrame",
"RBXScriptSignal": "RBXScriptSignal",
}

IGNORED_INSTANCES: List[str] = [
Expand Down Expand Up @@ -166,10 +165,8 @@
type BinaryString = string
type QDir = string
type QFont = string
type Function = (any) -> any
type FloatCurveKey = any
type RotationCurveKey = any
type CoordinateFrame = CFrame
declare class Enum
function GetEnumItems(self): { any }
Expand Down Expand Up @@ -422,8 +419,6 @@ def resolveType(type: Union[ApiValueType, CorrectionsValueType]) -> str:

if category == "Enum":
return "Enum" + name
elif category == "DataType":
return name
else:
return TYPE_INDEX[name] if name in TYPE_INDEX else name

Expand Down Expand Up @@ -541,8 +536,6 @@ def printClasses(dump: ApiDump):
continue
print(f"type {klass['Name']} = any")

print("type Objects = { Instance }")

for klass in dump["Classes"]:
if klass["Name"] in DEFERRED_CLASSES or klass["Name"] in IGNORED_INSTANCES:
continue
Expand Down
Loading

0 comments on commit 9644c05

Please sign in to comment.