dfinity / vscode-motoko Goto Github PK
View Code? Open in Web Editor NEWMotoko language support for VS Code.
License: Apache License 2.0
Motoko language support for VS Code.
License: Apache License 2.0
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.
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?
test/vessel.dhall :
let mainVessel = ../vessel.dhall
in mainVessel
with dependencies = mainVessel.dependencies # [ "matchers" ]
This is after the installation of
https://github.com/kritzcreek/motoko-matchers/tree/master/src
I followed CanDB's way of installing this, and I haven't done this ever before!
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 ?
@kritzcreek, do you know who currently has access to the VS Marketplace publisher for this extension?
I am hoping to start up the release pipeline again, which will involve getting access to the publisher account and creating a new access token.
Thanks for your help!
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.
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
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.
Thanks
In some jurisdictions using an unlicensed product is legally hazardous.
src/Char.mo
The other features (like go to definition) also don't seem to work.
My project has the Ledger canister installed locally.
When importing it using 'import Ledger "canister:ledger";', the extension throws this error:
The dfx.json has both the ledger canister defined and the dependency declared:
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.
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.
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.
How Motoko supports display outlines in VS Code
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.
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.
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.
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
.
I've installed motoko, but it keeps showing me the message that I don't have it. is there correct way to do it?
when working with gitsubmodules and nested dfx projects, inner vessel dependencies are not recognized by the LS.
see this repo for example
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:
Any idea?
Do I need to install or configure mops for the extension to work? (I don't have it installed)
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
Syntax highlighting is off there.
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
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
when launching vscode from within the canister
folder, everything works as expected.
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
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:
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.
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.
Personally use "Go to Definition" which is usually at the top of the context menu
now "Motoko: Deploy (20 Minutes)" is 😅
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.
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
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
Hey guys,
Go to Definition is not working properly:
VSCode-Version: 1.57.0
Extension-Version: v0.3.9
Dfx-Version: 0.7.1
Project builds fine, but in vscode I see erros like this:
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
Code formatter messes up anonymous functions as function parameters, puts them in one line and when there are comments, breaks the code.
Motoko Extension v0.3.9
VSCode v1.67.2
Windows 10 Pro
The service fails to start automatically or manually
Entry points tried: the '.mo' file, project directory, directory containing the .mo file
the formatter currently doesn't seem to like multi line string literals
https://github.com/flowerpowerdao/power-equalizer/blob/428563c87a11115a133e8d41386eba3dfd1f4078/src/Http/lib.mo#L146
The other features (like go to definition) also don't seem to work.
operator is not the reserved keywords, but it is highlighted like keyword:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.