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

Add "Import Mops Package..." command #244

Merged
merged 7 commits into from
Sep 8, 2023

Conversation

ZenVoich
Copy link
Contributor

@ZenVoich ZenVoich commented Sep 8, 2023

Search, install and import packages from Mops.

image

v

image

After package select, adds package to mops.toml.
If active file is *.mo - adds import line.


Also now new package import added after the latest import of the same package, or after latest "mo:..." import.

For example:

import Array "mo:base/Array";
import Local "./local";

add Map import from map package:

import Array "mo:base/Array";
+import Map "mo:map/Map";
import Local "./local";

add Trie import from base package:

import Array "mo:base/Array";
+import Trie "mo:base/Trie";
import Map "mo:map/Map";
import Local "./local";

@rvanasa
Copy link
Contributor

rvanasa commented Sep 8, 2023

This is awesome! Thank you for the contribution!

@rvanasa rvanasa merged commit 0db883d into dfinity:master Sep 8, 2023
2 checks passed
@rvanasa
Copy link
Contributor

rvanasa commented Sep 8, 2023

After some further testing, I've noticed that mopsAdd() sometimes doesn't add the package to the mops.toml config, although the package is installed in the .mops directory as expected. Based on the extension logs, this seems to be caused by the language server crashing (unfortunately without a readable error message).

I'll let you know if I come across any other useful debugging information, and thanks again for this PR!

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

Successfully merging this pull request may close these issues.

2 participants