Giter Club home page Giter Club logo

vscode-motoko's People

Contributors

davidm-d avatar dependabot[bot] avatar dfx-json avatar ggreif avatar kritzcreek avatar rvanasa avatar zenvoich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-motoko's Issues

do {} statement prettifies to one long line?

I may have got this wrong, but here's the before and after...

image

image

it appears to be something to do with the initial (( as I'm passing a tuple into the Buffer. If I change it to a single bracket the code doesn't work but the formatting looks normal.

image

canister alias "ledger" not defined

When importing the ledger canister, I get the following error highlight "canister alias "ledger" not defined". The canister is defined in dfx.json. When I compile, I do not get an error and I am also able to successfully call ledger methods in local development and on the production version.
Also only the import error is highlighted, no other errors that are present in the file are highlighted.

Existing work

I just wanted to point out that there is existing work in this area that includes the language server integration:
https://github.com/dfinity-lab/dev/tree/master/sdk/vscode-actorscript
https://github.com/dfinity-lab/dev/tree/master/sdk/actorscript-tmlanguage

Also: https://github.com/dfinity-lab/dev/pull/1113

I had planned on moving this to the SDK repo at the appropriate time, since I think the versions of moc, mo-ide, dfx, etc need to be kept in sync

We deprioritized it a little while ago but I think we’ll probably get back to it soon. cc @stanleygjones

motoko template files

I have Go code that generates Motoko, and the vs code plugin is recognising the template files and giving me errors. I renamed them to .mt not .mo and that worked before, but now the latest 0.4.4 is generating errors.

Could we please have a setting that allows us to specify the file extension? I've seen that on a few things like prettify. Or maybe there's a better solution.

image

Thanks

Feature request: hide specific compiler warnings

Context: Dfinity forum post

There should be a way to hide specific compiler warnings in the VS Code extension (for example, the Array.append() deprecation warning for those who still need to use this method for various reasons).

We seem to have a few mutually compatible ways to approach this:

  • Implement linter-style ignore comments at the compiler level (is this feasible?)
  • Add a global config option to hide warnings based on a regular expression (will most likely add this in any case)

I am currently working on a bundled TypeScript language server implementation, so the latter approach will be trivial once this fully replaces the OCaml LSP. However, because this could take a few months, I'm creating this PR in case anyone has ideas for an immediate-term solution.

Motoko deploy command ERROR

When I attempted to deploy using the 'Motoko: Deploy' command in Visual Studio Code, I received the following error message:
'Request vscode-motoko/deploy-playground failed with message: Record is missing key "start_page".'

This occurred while trying to deploy a project to the Motoko playground.

Any suggestions on how to resolve this missing 'start_page' key issue would be greatly appreciated.

Continuous "Reference not found from AST node:" errors

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)

files being checked for errors after deletion

So we generate a bunch of files in a generated/ directory, and then move them to where they're supposed to live. I think we're going to change this to write the files directly (which would fix this bug for us.) Anyway,

image
image

After the files are moved we still get all these phantom errors appearing.

management canister did file not found

this canister builds, and .dfx/local/canisters/idl/aaaaa-aa.did is being generated.

import Management "ic:aaaaa-aa";

actor class Main() {
	public func greet(name : Text) : async Text {
		ignore await Management.raw_rand();
		return "Hello, " # name # "!";
	};
};

the vscode extension wants the did in a different path though
file "/Users/moritz/projects/icrc7_launchpad/.dfx/local/lsp/aaaaa-aa.did" does not existMotoko(M0009)

dfx 0.16.0
motoko extension v0.14.8

Can't find extension on vscode

I just can't find the Motoko extension on my vscode I also tried the contributing commands still I can't install. I also have both node and npm installed but still I'm unable to install the extension.

import handling

Hi Ryan,

Would it be possible to have something like in VSCode for go, where the imports automatically get added/removed based on the code? What's the complexity of something like that?

It would save us so much time. Also, would help getting rid of unneeded imports which is huge when you have loads of canisters.

How to disable autoformating of comments?

Motokodoc will create a new line if there are two empty trailing characters of the last line, however now I've noticed the formatter trims any trailing empty space breaking intentional formatting of Motokodoc. Is there a way to disable this for Motokodoc?

If that's not clear, in code:

Legend: ∅ -> a white space

/** Some Method's Motokodoc Title...∅∅
More info such as params etc and finally end of Motokodoc. */
public func aFunMethod() : async Text { debug_show(this) }; 
Previously this would generate a tooltip like:
() -> Text
Some Method's Motokdoc Title..
More info such as params etc and finally end of Motokodoc.
----------------------------------------------------------------------------------

But now it's all one run on line.

Code formatter, anon functions

Code formatter messes up anonymous functions as function parameters, puts them in one line and when there are comments, breaks the code.

CMD+Click does not jump to definition

Other language extensions allow me to CMD+Click on a function call, for example, to jump to the definition of that function. This does not work for Motoko when using this extension. I'd expect jumping like this to work for other situations too, like jumping from a variable's usage to its declaration, or from an import to the file being imported.

extension don't see mops packages

Project builds fine, but in vscode I see erros like this:

image

LS output:

Parsed typed AST
Loading packages for directory: e:\ic\mops
Running `mops sources` in directory: e:\ic\mops
Loading packages for directory: e:\ic\mops\backend
Received: ["--package","base",".mops\\[email protected]\\src","--package","time-consts",".mops\\[email protected]\\src",""]
Package: base -> /e:/ic/mops/.mops/[email protected]/src (file:///e%3A/ic/mops)
Package: time-consts -> /e:/ic/mops/.mops/[email protected]/src (file:///e%3A/ic/mops)
Checking workspace
~ /e:/ic/mops/backend/storage/storage-canister.mo (file:///e%3A/ic/mops/backend)
~ /e:/ic/mops/backend/main/validate-config.mo (file:///e%3A/ic/mops/backend)
~ /e:/ic/mops/backend/main/types.mo (file:///e%3A/ic/mops/backend)
~ /e:/ic/mops/backend/main/download-log.mo (file:///e%3A/ic/mops/backend)
~ /e:/ic/mops/backend/storage/storage-manager.mo (file:///e%3A/ic/mops/backend)
~ /e:/ic/mops/test/fail.test.mo (file:///e%3A/ic/mops)
~ /e:/ic/mops/backend/main/main-canister.mo (file:///e%3A/ic/mops/backend)

windows 10
vscode-motoko 0.9.1

Import of a canister throws an error: "canister alias not defined"

My project has the Ledger canister installed locally.

When importing it using 'import Ledger "canister:ledger";', the extension throws this error:

image

The dfx.json has both the ledger canister defined and the dependency declared:

image

Deploying and building are ok, dfx doesn't show any error. That's just shown on vscode and the extensions stops checking any other syntax error even if it's in a different motoko file, making it really hard to develop any complex project.

100% CPU load with this extension

When I'm working on mops VSCode loads the cpu at 100%.

Checked versions:
0.8.2 - 100% CPU load
0.7.4 - 100% CPU load
0.6.4 - works fine

Buggy behaviour with go to definition

Hey guys,

Go to Definition is not working properly:

  • import Map "mo:base/HashMap"; says "No definition found for 'Map'
  • generally only working on expressions like Map.HashMap (with a dot)
  • don't work on Text type, only works on "Text.equal" with a dot

VSCode-Version: 1.57.0
Extension-Version: v0.3.9
Dfx-Version: 0.7.1

performance improvements

currently with complex projects it takes a couple of seconds until the extension is up to date.
e.g. when I type : Text to specify the type of a function argument, i can hover the text with my cursor and watch the progress of the tool with the info text updating like
unbound type T
unbound type Te
unbound type Tex

Do you support showing an outline?

I found that the outline display cannot be provided in the vscode outline panel area. This function is very useful when developing relatively large applications. Is there any plan to support it in subsequent versions?

Issues with vessel

Screen Shot 2022-12-08 at 1 47 15 PM

I will keep looking into this issue but .vessel is installed in the project. Not sure if there is something else I need to do for it to find those references.

Thanks again for help.

Error: Error while finding MOPS packages.

Hey @rvanasa, I've been using this vscode extension for a while now and would like to say that it's been very helpful for formatting and highlighting errors and warnings. 🙌

It has been working great for me, however the latest update to the extension throws an error for me on initialization:

Error: Error while finding MOPS packages.
Make sure MOPS is installed locally or globally (https://mops.one/docs/install).
Command failed: npx --no ic-mops sources
npm ERR! canceled

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dire.sol/.npm/_logs/2023-01-12T03_24_14_372Z-debug.log

I tried running this command locally in my terminal and found out that it asks to install the package before running the command.

npx ic-mops sources
Need to install the following packages:
  ic-mops
Ok to proceed? (y)

When I responded with a yes (y) the command ran successfully and returned the file paths for all my dependencies

npx --yes ic-mops sources
--package base .mops/_github/[email protected]/src
--package array .mops/_github/[email protected]/src
--package StableTrieMap .mops/_github/StableTrieMap@main/src
--package StableBuffer .mops/_github/[email protected]/src
--package itertools .mops/[email protected]/src

Import can't find files

Sometimes Motoko language server works and finds its files, sometimes it doesn't. Reloading doesn't help. Everything seems to be set properly, mops & dfx.json. Can't even find a local file. The only difference I can see is my git root is not where dfx.json is. Perhaps that path is being used? How the language server detects its dfx.json ?
image

Language service fails to start

Motoko:Start/Restart language service

Motoko Extension v0.3.9
VSCode v1.67.2
Windows 10 Pro

Issue

The service fails to start automatically or manually
Entry points tried: the '.mo' file, project directory, directory containing the .mo file

Screenshots

Error from command palette
Capture

Error after running service from command palette
Capture

Error in Output pane
Capture

Clicking on errors in console should jump to correct column, not just line

When an error is printed to the console. it includes both the line and column number. Clicking on the error jumps the cursor to the correct line, but puts it at the beginning of the line, column 0. I often have to count characters to see in more detail where the error occurred. Ideally I wouldn't have to do this manual step, and the cursor would jump to the correct column as printed, not just the line.

Feature Request: Function Signature Args and Linking in "Motokodoc"

Could someone could point me to the file that handles the "Motokodoc" formatting and logic (particularly for the tooltip popup on hover that shows up when a field as the Motokodoc comment header)?

In particular I'd like to add autogeneration/highlighting for argument and return signature, as well the ability to point the comment to another Motokodoc comment.

Code formatter

It would be great if the code formatter work.
I'm talking about the integrated one that works with this shortcuts.

On Windows Shift + Alt + F
On Mac Shift + Option + F
On Linux Ctrl + Shift + I

Packaging complains that there are too many files

from npm run package:

This extension consists of 1367 files, out of which 540 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore

This is low-prio.

DFX 0.11.2

After upgrading to dfx 0.11.2. The extension seems to start correctly.
image
However no errors are being shown. When I downgrade back to 0.10.0 everything works fine again and errors are highlighted.

VSCode extension allows Trie.empty() with no generic type but moc throws error

Let's say you have a record typed as such:

public type Foo = {
    var map: Trie.Trie<Text, Nat>;
};

And you initialize a record of type Foo as such:

let foo: Foo = {
    var map = Trie.empty();
};

The VSCode extension is totally fine with this and throws no error.

But when you run dfx build, the compiler complains with this:

Stderr:
Ill-typed intermediate code after Desugaring (use -v to see dumped IR):
(unknown location): IR type error [M0000], subtype violation:
  {var map : Trie<None, None>}
  {var map : Trie<Text, Nat>}

Note: this only happens if the field is prefixed with var.

extension does not recognize canister alias when project is in subdirectory

consider the following structure

my-monorepo/
  |- package.json
  |- yarn.lock
  |- workspaces/
      |- canister/
          |- Cargo.toml
          |- src/
      |- proxy/
          |- package.json
          |- src/

when importing a canister using the canister:canister_name syntax, when i launch vscode from within the my-monorepo folder, the following error appears
Screenshot 2023-03-08 at 15 45 13
when launching vscode from within the canister folder, everything works as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.