Support JavaScript by default
aminya opened this issue · comments
Could you change the settings to support JavaScript by default? For doing so:
- Adding activation hooks for JavaScript
- Setting the related config.
In many other IDEs, TypeScript services are used for JavaScript by default.
I'm reluctant to enable javascript by default because this would probably interfere with other javascript packages. I'm inclined to leave it as opt-in. An argument could be made that actual "opt-in" is a bit of a hassle, but since the end-users are implied to be developers who hopefully know what they're doing, it's less of an issue I think.
For mjs, it's not recognized as js file extension. You can add it to Atom-TypeScript settings manually (the change won't take effect until Atom restart/reload):
Probably a good idea to add mjs
and cjs
to the defaults though.
I'm reluctant to enable javascript by default because this would probably interfere with other javascript packages.
I don't this happens. There is no JavaScript IDE for Atom and non of the features that atom-typescript provides are offered anywhere else. There will not be any interference. TypeScript service can work in combination with other packages. As an example, Eslint and TS can both offer listing features.
Especially since I plan to include atom-typescirpt in atom-community
builds, I would love to see atom-typescript support JS by default. I plan to give an out of the box experience to the users. Those who like tinkering with settings can use the bare bone atom
instead.
Well, feel free to patch your bundled version then, it's really not that hard (add language-javascript:grammar-used
to activation hooks and change allowJS
default to true
-- easy enough with a script).
I am a tinkerer and I hate packages that overstep their bounds. I'm pretty sure there are plenty of users who don't want to deal with TypeScript in their JS code, and are perfectly happy with ESLint. Those people won't appreciate it if Atom-TypeScript starts suddenly activating on JavaScript files and showing hundreds of useless warnings like "could not find declaration for module" etc.
If you feel like that, I can make a synchronized fork instead that chooses some default settings. I will only apply minimal changes for the sake of out of the box experience. Mostly:
- activation hook for JavaScript
- Setting that config to
true
Sure, that would be fine.
Side note: if you're going to bundle Atom-TypeScript with Atom, you'll probably want to include it into the snapshot which as far as I understand would make activation hooks irrelevant.
@lierdakil I created the package. Instead of patching atom-typescript, I decided to make a proper atom-ide-javascript, and use typescript through the services, etc.
https://github.com/atom-ide-community/atom-ide-javascript
BTW, thanks for the activate
command in the last version. Now, here is the function:
https://github.com/atom-ide-community/atom-ide-javascript/blob/master/src/typescript.js
Can we set up service or config that I can turn off some of the typescript linter messages inside atom-ide-javscript? Things like "missing declaration file", or "you can only use type annotation in typescript files" (while flow also allows that).
The last release makes the following settings grammar-scoped:
- suppressAllDiagnostics
- ignoredDiagnosticCodes
- ignoreUnusedSuggestionDiagnostics
- ignoredSuggestionDiagnostics
- ignoreNonSuggestionSuggestionDiagnostics
- unusedAsInfo
Refer to package.json
for descriptions:
Lines 156 to 196 in 2a131ca
Lines 30 to 36 in 2a131ca
You can override those specifically for source.js
scope (for instance), e.g.
atom.config.set("atom-typescript.suppressAllDiagnostics", true, {scopeSelector: ".source.js"})
You're probably most interested in ignoredDiagnosticCodes
. Refer to https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json for codes (codes are stable, unlike messages, which can be affected by version, locale, etc)
This issue has been marked as stale because it did not have any activity for the last 90 days or more. Remove the stale label or comment or this will be closed in 14 days