IntelliJ-Luanalysis icon indicating copy to clipboard operation
IntelliJ-Luanalysis copied to clipboard

Support Roblox Lua

Open matthargett opened this issue 3 years ago • 8 comments

Environment

name version
IDEA version CL2021.2 RC
Luanalysis version v1.3.0
OS OSX 11.5.1

What are the steps to reproduce this issue?

  1. Use Roblox Lua type features:
local Constants = require(script.Parent.Constants)
type Passthrough<T> = Constants.Passthrough<T | nil, any?>
type Set<T> = {
	size: number,
	-- method definitions
	add: (Set<T>, T) -> Set<T>,
	clear: (Set<T>) -> (),
	delete: (Set<T>, T) -> boolean,
	has: (Set<T>, T) -> boolean,
	ipairs: (Set<T>) -> any,
}
type Array<T> = { [number]: T }
local myArray: Array<string> = { "hello", "world"}
local mySet: Set<Array<Passthrough<number>>> = Set.new()
mySet:add({math.huge, 2, Constants.ZERO})
  1. See parse errors

What happens?

Some basics of Roblox Lua get parse errors very early in the file, resulting in most navigation features not working.

What were you expecting to happen?

The ability for the plugin to auto-detect the variant of Lua and to support navigation (control/command+click, etc).

Any logs, error output, etc?

image

matthargett avatar Jul 27 '21 21:07 matthargett

I'm mostly focused on stability at the moment as there's a few nasty bugs, but am keen to add Luau support.

If anyone wants to try tackle this before I get to it, please let me know.

Benjamin-Dobell avatar Jul 28 '21 01:07 Benjamin-Dobell

@matthargett Do Roblox have a developer tooling team that is interested in stuff like Luanalysis? If so, I'd be keen to have a chat. Feel free to email me. If not, no worries 😂

Benjamin-Dobell avatar Sep 03 '21 18:09 Benjamin-Dobell

@matthargett Do Roblox have a developer tooling team that is interested in stuff like Luanalysis? If so, I'd be keen to have a chat. Feel free to email me. If not, no worries 😂

Arseny has open Twitter DMs: https://twitter.com/zeuxcg

LoganDark avatar Apr 09 '22 08:04 LoganDark

@matthargett Do Roblox have a developer tooling team that is interested in stuff like Luanalysis? If so, I'd be keen to have a chat. Feel free to email me. If not, no worries 😂

There is a developer tooling team, and a languages team. I don't know that either would be explicitly interested in this project, but I don't speak for them -- just myself 😃

The language grammar specification and parser source code are all public, with reference implementations in C++ at GitHub.com/Roblox/luau and in Rust at github.com/Kampfkarren/full-moon .

matthargett avatar Apr 09 '22 20:04 matthargett

github.com/Kampfkarren/full-moon

Full Moon is not a reference implementation of Luau, it's just a parser for source code transformations, and it's not even official.

LoganDark avatar Apr 10 '22 17:04 LoganDark

github.com/Kampfkarren/full-moon

Full Moon is not a reference implementation of Luau, it's just a parser for source code transformations, and it's not even official.

Sorry, I thought I scoped it with “parser source code” to make it clear. full-moon provides a read and write AST that retains trivia, and is used heavily by the global Lua community even beyond Roblox. The extremely robust StyLua formatter uses full-moon, and as such it might be a good candidate for mapping to IntelliJ’s API in a way that allows for automated refactoring and not just syntax highlighting.

I hope this clarifies the matter :D

matthargett avatar Apr 10 '22 23:04 matthargett

Sorry, I thought I scoped it with “parser source code” to make it clear. <full-moon ad>

You said "the parser source code", even though it's not the official Luau parser as used by Roblox. you also said "reference implementations in [...] Rust at github.com/Kampfkarren/full-moon", and full-moon isn't a reference implementation at all. I'd recommend splitting out full-moon more, something like this:

The language grammar specification is public, with reference implementation in C++ at https://github.com/Roblox/luau/. There's also a community-made Rust parser at https://github.com/Kampfkarren/full-moon.

I have nothing against full-moon, just try not to pass it off as official. Your comment could be misinterpreted by a passerby.

LoganDark avatar Apr 10 '22 23:04 LoganDark

In Github issues, if we can restrict the analysis of semantics to code, that'd be most appreciated 🙂 Thanks!

Benjamin-Dobell avatar Apr 11 '22 00:04 Benjamin-Dobell