Script Editor Service > Register Autocomplete Callback, callback dose not enforce any typing, it must be set manual, this is very confusing to newer developers.
The callback typing should be something close to:
export type LineInfo = {line: number,character: number}
export type LineRange = {[“start”]:LineInfo,[“end”]:LineInfo}
export type ResponseItem = {
label: string, – Name
kind: Enum.CompletionItemKind?, – Icon
tags: {Enum.CompletionItemTag}?, – Engine Tags Give info to engine of what type completion it is.
detail: string?,
documentation: {
value: string,
}?,
overloads: number?,
learnMoreLink: string?, – URL Must point to ( create.roblox.com ) Other links will not be displayed.
codeSample: string?,
preselect: boolean?, – Priority Over Base Engine Types. (Default to false)
textEdit: {
newText: string,
insert: LineRange,
replace: LineRange,
}?
}
export type Request = {
position:LineInfo,
textDocument: {
document: ScriptDocument?,
script: LuaSourceContainer?
}
}
export type Response = {items:{ResponseItem}}
export type AutocompleteCallback=(Request,Response)->(Response)
Hey Classy, can you clarify what you’re trying to achieve here? It sounds like this is more of a concern with the API design than the documentation, but I’m curious to know what you’re building so that I can route the request a bit better. Thanks!
I’m currently building a Tween and Tagging autocomplete utility to streamline developer workflows in Studio. The core issue is that ScriptEditorService feels like a ‘black box’ because the callback isn’t strictly typed in the engine’s Luau definitions.
While I can manually recreate the types from the documentation, it’s a major roadblock for two reasons:
Silent Failures: If a developer makes a small typo in the returned table (e.g., Label instead of label), the autocomplete simply doesn’t show up. There are no linter warnings to explain why because the API accepts any.
Boilerplate: Every developer building editor tools has to manually define AutocompleteRequest and AutocompleteResponse just to get intellisense.
Adding native types like AutocompleteRequest and AutocompleteResponse directly to the API would make this service self-documenting. It would allow the linter to catch errors immediately, which is especially important for newer developers trying to extend the editor.
By making the callback signature strictly (Request) -> Response, you’d significantly improve the stability and developer experience for anyone building Studio plugins.