Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous "Reference not found from AST node:" errors #247

Open
ottodevs opened this issue Sep 14, 2023 · 5 comments
Open

Continuous "Reference not found from AST node:" errors #247

ottodevs opened this issue Sep 14, 2023 · 5 comments

Comments

@ottodevs
Copy link

Hello, I am facing some issues with the extension.

I have latest vscode, with prettier and motoko extension installed.

I installed latest dfx 0.14.4 following the official guide (curl)

I created a simple project with dfx new sample_project

The vscode extension does not seem to work, no formatting, no inputs, no syntax highligting, intellisense or import actions...

The extension output looks like this after hovering some part of the motoko file:
image

Any idea?

Do I need to install or configure mops for the extension to work? (I don't have it installed)

@ottodevs
Copy link
Author

I also tried to install prettier-plugin-motoko separately and configure it in a .prettierrc file, without success, but I understand from the extension documentation that shouldn't be needed, am I right?

@rvanasa
Copy link
Contributor

rvanasa commented Sep 14, 2023

Happy to help debug. Is this your first time downloading the extension? Also, what operating system are you using?

The extension output looks like this after hovering some part of the motoko file:

The "Reference not found from AST node" messages are actually just debug information, so you can safely ignore them.

I also tried to install prettier-plugin-motoko separately and configure it in a .prettierrc file, without success, but I understand from the extension documentation that shouldn't be needed, am I right?

Yep that's correct; the formatter is built into the extension, so it should work out of the box without installing anything. You should also be okay without installing Mops for the dfx new starter project, so hopefully that helps narrow down the possible causes.

@ottodevs
Copy link
Author

Happy to help debug. Is this your first time downloading the extension? Also, what operating system are you using?

The extension output looks like this after hovering some part of the motoko file:

The "Reference not found from AST node" messages are actually just debug information, so you can safely ignore them.

I also tried to install prettier-plugin-motoko separately and configure it in a .prettierrc file, without success, but I understand from the extension documentation that shouldn't be needed, am I right?

Yep that's correct; the formatter is built into the extension, so it should work out of the box without installing anything. You should also be okay without installing Mops for the dfx new starter project, so hopefully that helps narrow down the possible causes.

Hi again! I am using macOS Ventura, up to date.

After spending some time testing things, now I think I made it working.

It seems some syntax error in the motoko code prevented the auto-formatting to work, I expected to have vscode messages for these kind of issues, like eslint or similar, but I think we are not there yet (not complaining, tho, I appreciate how hard is to build a tool like this).

It is weird because some issues like typos on keywords or wrong imports, show up as problems on vscode, but things like missing semicolon after a expression are not raising an issue apparently (but they prevent auto-formatting to work properly)

The inputs (intellisense) also seem to work.

Another missing part is with imports from the extension, by calling "Motoko: Import Mops Package", the import shows up as not found, but I guess there is already an open issue for that.

I will keep debugging and try to be more specific or helpful reporting issues as I learn and better understand the scope of the extension.

Thank so much for the support and patience.

@rvanasa
Copy link
Contributor

rvanasa commented Sep 16, 2023

It seems some syntax error in the motoko code prevented the auto-formatting to work, I expected to have vscode messages for these kind of issues, like eslint or similar, but I think we are not there yet (not complaining, tho, I appreciate how hard is to build a tool like this).

This is very unusual; syntax errors should be showing up in the editor. Thank you for reporting this so we can try and find a solution in case anyone else is also running into this. Did you happen to change anything in the extension settings?

Another missing part is with imports from the extension, by calling "Motoko: Import Mops Package", the import shows up as not found, but I guess there is already an open issue for that.

This feature was contributed very recently by the author of Mops. Pinging @ZenVoich in case he has any suggestions.

@ZenVoich
Copy link
Contributor

Another missing part is with imports from the extension, by calling "Motoko: Import Mops Package", the import shows up as not found, but I guess there is already an open issue for that.

Do you have a mops.toml file in the project root directory?

Does the error appear on the import line or somewhere else?

If you could provide a full error message, that would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants