Not sure when this started happening, but non-closed functions and “if” statements are no longer being properly linted within the editor unless the last line of code in the script is empty. The Script Analysis window still catches the issue, but the red underscores within the editor are not present. Considering this update focused on the Studio Script Editor, I suspect this issue could be related to the update.
Problem Details:
The PlayerAdded function in the following code is not closed properly. Yet, if there is anything on the last line of the script (there is a tab in this case), Studio does not lint the issue correctly.
If the last line is empty, this issue is linted correctly:
Here is a place file which contains two scripts that show this behavior. The scripts are located in ServerScriptService: LintingIssue_201009.rbxl (20.7 KB)
I was criticizing the Editor and now I retract myself. THANK YOU! Now looks better, I do noticed some deprecated Globals are getting highlighted and they weren’t before.
I don’t know about anyone else but there was a bug where the little color picker appeared on the lines side of the script editor. Also, for a while, the command bar was syntax highlighting.
Still leaves me to wonder when we get this feature in text boxes.
Something that I’ve just noticed and is starting to bother me is that now when you focus on a word (without selecting) it highlights all other words with the same name, usually this is done when you select the word manually by double clicking. After checking out 2 industry level IDEs, they either don’t do this or keep the words selected when they are highlighted. Could this please be reconsidered.
I’d love an option for this, but a workaround is to set the “Matching Word Background Color” to be the same as your “Background Color” in the studio editor colors and you won’t see it anymore
continue was added to Luau and has been available for over half a year. You may read more about its addition to Luau in the following post:
As for self, it is a keyword that is built into Lua; and it assumes as you’ve mentioned the first argument of a function call to a method, usually a table. The term keyword does not necessarily mean that the word cannot be overridden, but the fact that it is a word used to access a variable handled by the language. As such the term keyword is appropriate.
local module = {}
module.Function = function() return end
function module:Thing()
self.Function() -- No error, highlighted
end
while wait() do
continue -- No error
end
self can’t be a keyword; otherwise it couldn’t be used as a variable. It often gets highlighted exceptionally because it is assigned implicitly when using the Method syntax sugar. Roblox chose to highlight it using the same style as keywords, hence the confusion. If there are any doubts, the Lua manual lists every keyword:
continue (and type) are Luau-exclusive tokens whose type depends on the context. Presumably, Roblox’s custom syntax highlighter will eventually style them the same as keywords when they are used as statements, or as variables otherwise.
A syntax highlighter does not determine the type of a token. It’s the other way around; the type of a token determines how it will be styled. Often, the grammar of a syntax highlighter is more primitive than the grammar of the language being highlighted, so exceptions are made if something can’t be accurately represented. Ideally, both grammars would be exactly the same, which Roblox is taking steps towards achieving.
Indeed, I stand corrected. The term keyword in the context of programming implies that it cannot be used as an identifier, which conflicts with the semantic definition of the term “keyword”, which I understand to be a word with a special meaning. This is what was intended by my post.
Thank you for the clarification, it’s greatly appreciated.
The issue as I see it is that the continue token and any references to the word self were previously highlighted and bolded. This change actively made my code more confusing to read, and removes a previous feature.