Stillat / vscode-antlers-language-server

Provides rich language features for Statamic's Antlers templating language, including code completions, syntax highlighting, and more.
https://antlers.dev
MIT License
36 stars 3 forks source link

Not seeing an `antlers.json` file within project / no autocomplete for fields, collections #89

Closed aaronbushnell closed 3 months ago

aaronbushnell commented 3 months ago

Describe the bug Sorry for submitting another bug report here—I might be doing something wrong. I've got the extension installed, but I'm not seeing an antlers.json file being generated for my project (which seems to be the way to determine if the extension is working off your Statamic project).

I've tried swapping the "Antlers Language Server: Language Version" from regex to runtime and neither seemed to help in my case.

Happy to supply any debugging information you might need for this one!

I'm not sure if this is related, but when I use {{ }} in an Antlers file I get this output in the Output area of VS Code:

2024-06-06 08:28:09.943 [error] name must not be falsy: Error: name must not be falsy
    at Function.validate (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:151:18100)
    at new h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:151:18395)
    at asDocumentSymbol (/Users/aaron/.vscode/extensions/stillat-llc.vscode-antlers-2.6.18/client/node_modules/vscode-languageclient/lib/common/protocolConverter.js:522:22)
    at Array.map (<anonymous>)
    at Object.asDocumentSymbols (/Users/aaron/.vscode/extensions/stillat-llc.vscode-antlers-2.6.18/client/node_modules/vscode-languageclient/lib/common/protocolConverter.js:519:23)
    at /Users/aaron/.vscode/extensions/stillat-llc.vscode-antlers-2.6.18/client/node_modules/vscode-languageclient/lib/common/client.js:1108:70
    at h.provideDocumentSymbols (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:153:98122)

Impacted Products Which Antlers Toolbox products does this bug apply to?

Versions and Other Plugins/Extensions

To Reproduce

JohnathonKoster commented 3 months ago

The extension won't publish an antlers.json file (or shouldn't) when running the Reload Statamic Project Details command. Do you get any suggestions at all if you place the cursor like so and manually trigger the completions shortcut {{ | }}?

image

An easy way to tell if the extension has loaded is if syntax highlighting works and the language has changed to HTML (Statamic Antlers):

image

I'm not able to reproduce this at the moment, so any extra info about the project itself or other installed extensions would be helpful. Thanks!

aaronbushnell commented 3 months ago

Ah, nevermind, @JohnathonKoster, this was user error here! While I had some autocomplete the field names weren't autocompleting for me because I was in a dynamic template I was using for a Replicator field.

As soon as I tested out this in another template:

{{ collection:blog }}

{{ /collection:blog }}

And typed out {{ su I got the summary field I expected. Thank you!