Skip to content

Commit

Permalink
fix settings should take effect immediately
Browse files Browse the repository at this point in the history
updated to mythxjs from armlet
prepare 0.0.9
  • Loading branch information
tintinweb committed Dec 11, 2019
1 parent b208b27 commit 4045a2d
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 76 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.0.9
- updated mythx library: switched from `armlet` to `mythxjs`.
- fix: make settings take effect immediately.

## 0.0.8
- fix misused promises

Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ Note: Active features can be disabled by setting `Settings` → `Vyper` → `Mod

see [CHANGELOG](./CHANGELOG.md)

## 0.0.8
- fix misused promises

## 0.0.7
- updated grammar
- fixed mythX issue due to API change
- fixed diagnostics handling: compiler warnings and mythx are now updated on a per file basis.
- fixed run compile / when file is opened the first time, not only on change.
## 0.0.9
- updated mythx library: switched from `armlet` to `mythxjs`.
- fix: make settings take effect immediately.

-----------------------------------------------------------------------------------------------------------
226 changes: 226 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "vscode-vyper",
"displayName": "Vyper",
"description": "Ethereum Vyper language support for Visual Studio Code",
"version": "0.0.8",
"license": "MIT",
"version": "0.0.9",
"keywords": [
"vyper",
"ethereum",
Expand Down Expand Up @@ -125,8 +126,9 @@
"fetchGrammar": "rm -f syntaxes/vyper.tmLanguage.json && python3 ./scripts/fetch_vyper_language_spec.py > syntaxes/vyper.tmLanguage.json"
},
"dependencies": {
"armlet": "^2.3.0",
"async": "^2.6.2",
"chai": "^4.2.0",
"mythxjs": "^1.3.1",
"shell-escape": "^0.2.0"
}
}
34 changes: 15 additions & 19 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@
* */

/** imports */
const vscode = require("vscode")
const crypto = require("crypto")

const mod_deco = require("./features/deco.js")
const mod_signatures = require("./features/signatures.js")
const mod_hover = require("./features/hover/hover.js")
const mod_compile = require("./features/compile.js")
const mod_analyze = require("./features/analyze.js")
const vscode = require("vscode");

const mod_deco = require("./features/deco.js");
const mod_signatures = require("./features/signatures.js");
const mod_hover = require("./features/hover/hover.js");
const mod_compile = require("./features/compile.js");
const settings = require("./settings");
/** global vars */
const VYPER_ID = "vyper";
const vyperConfig = vscode.workspace.getConfiguration(VYPER_ID);
var activeEditor;

/** classdecs */
Expand All @@ -29,23 +26,23 @@ var activeEditor;

/** event funcs */
async function onDidSave(document){
if(document.languageId!=VYPER_ID){
if(document.languageId != settings.LANGUAGE_ID){
console.log("langid mismatch")
return;
}

//always run on save
if(vyperConfig.compile.onSave){
if(settings.extensionConfig().compile.onSave){
mod_compile.compileContractCommand(document.uri)
}
}

async function onDidChange(event) {
if(vscode.window.activeTextEditor.document.languageId!=VYPER_ID){
if(vscode.window.activeTextEditor.document.languageId != settings.LANGUAGE_ID){
return;
}

if(vyperConfig.decoration.enable){
if(settings.extensionConfig().decoration.enable){
mod_deco.decorateWords(activeEditor, [
{
regex:"@\\b(public|payable|modifying)\\b",
Expand Down Expand Up @@ -94,9 +91,8 @@ async function onDidChange(event) {
}
}
function onInitModules(context, type) {
mod_hover.init(context, type, vyperConfig)
mod_compile.init(context, type, vyperConfig)
//mod_analyze.init(context, type, vyperConfig)
mod_hover.init(context, type)
mod_compile.init(context, type)
}

function onActivate(context) {
Expand All @@ -105,7 +101,7 @@ function onActivate(context) {
if (!active || !active.document) return;
activeEditor = active;

registerDocType(VYPER_ID);
registerDocType(settings.LANGUAGE_ID);

function registerDocType(type) {
context.subscriptions.push(
Expand All @@ -127,7 +123,7 @@ function onActivate(context) {
vscode.commands.registerCommand('vyper.compileContract', mod_compile.compileContractCommand)
)

if(!vyperConfig.mode.active){
if(!settings.extensionConfig().mode.active){
console.log("ⓘ activate extension: entering passive mode. not registering any active code augmentation support.")
return;
}
Expand Down
Loading

0 comments on commit 4045a2d

Please sign in to comment.