ironcev / without-guns-for-vs-code Goto Github PK
View Code? Open in Web Editor NEWVisual Studio Code extension that teaches you mindful programming
License: MIT License
Visual Studio Code extension that teaches you mindful programming
License: MIT License
Could you please help I could not install java in Visual sudio code
Clicking on the status bar item turns the Guns On and Off.
const host = (new class {
isFolderOpen = () => vscode.workspace.workspaceFolders != undefined;
showInformationMessage = (message : string) => vscode.window.showInformationMessage(message);
});
No need to create anonymous class and immediately instantiate it if you can create object on the spot, moreover it's not idiomatic:
const host = {
isFolderOpen: () => vscode.workspace.workspaceFolders != undefined,
showInformationMessage: (message : string) => vscode.window.showInformationMessage(message)
};
Type of the host object that typescript will infer:
host: { isFolderOpen: () => boolean, showInformationMessage: (message: string) => undefined };
Instead of:
export { GunController };
export { IntelliSenseGunController };
export { CodeLensGunController };
export { SyntaxHighlightingGunController };
You can short it like this:
export {
GunController,
IntelliSenseGunController,
CodeLensGunController,
SyntaxHighlightingGunController
}
Or you can do it even shorter with:
export { GunController } from "./GunController";
export { IntelliSenseGunController } from "./IntelliSenseGunController";
export { CodeLensGunController } from "./CodeLensGunController";
export { SyntaxHighlightingGunController } from "./SyntaxHighlightingGunController";
But this requires to remove default
keyword from all these files which is ok since default
keyword is not really that useful.
I see you use ==
and !=
comparison operators which coerce/convert types (if operands are of different type then one of them will be coerced to type of the other so they can be compared). If that is what you wanted to do then ok, but be aware of this behaviour. Alternative is to use comparison operators which don't coerce/convert types: ===
and !==
. Type coercion also happens when doing other stuff (if (x), a + b, ...).
Examples:
[] == true // -> this will evaluate to false because empty list ([]) is coerced into false
[1] == true // -> this will evaluate to true because non-empty list ([1]) is coerced into true
[] === true // -> this will evaluate to false because operands are of different types
[1] === true // -> this will evaluate to false because operands are of different types
Using non-coercive comparison operators is considered good practice in JavaScript/TypeScript world.
var
keyword, in ConfigurationDependentGunController.ts, demo.ts, index.tsKeywords var
, let
and const
introduce variable/value bindings, let
and const
are perfectly fine but var
has some serious issues and it should never be used as far as I am concerned.
Variables introduced by let
and const
are scoped to the nearest {}
block, variables introduced by var
are scoped to the nearest function body.
Example:
function lousyVar() {
var x = "var";
{
var x = "same var here";
console.log(x); // prints "same var here"
}
console.log(x); // prints "same var here" -> did we really wanted to change outer variable?
}
function niceLet() {
let x = "let";
{
let x = "totally different variable";
console.log(x); // prints "totally different variable"
}
console.log(x); // prints "let" -> outer variable with same name is preserved
}
Everything else seems fine.
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.