You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-37Lines changed: 1 addition & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -57,14 +57,6 @@ Some shortcuts:
57
57
*`ctrl+alt+i` will open the dev tools. These are the same Chrome dev tools you are familiar with. Feel free to inspect elements. This will come handy when doing UI or even seeing why a particular code element is highlighted in some way.
58
58
*`ctrl+alt+r` will reload the entire atom instance.
59
59
60
-
### Debugging
61
-
There are *lots of ways* to do this. The ones we use right now:
62
-
63
-
* You can do `console.error` from `projectService` and it will get logged to the atom's console (`ctrl+alt+i`). That's the quickest.
64
-
* You can call `projectService` in `sync` from the UI thread if you want to debug using atom's built in tools (`ctrl+alt+i`). Set `debugSync` to true in `./lib/worker/debug.ts`, and it takes care of the rest.
65
-
66
-
Also [if there is an error in `projectService` it gets logged to the console as a rejected promise](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/debugPromises.gif).
67
-
68
60
### General Steps
69
61
1. We open `atom-typescript` in one atom window
70
62
1. We have [`atom-typescript-examples`](https://github.com/TypeStrong/atom-typescript-examples) open in another atom window
@@ -75,24 +67,10 @@ Also [if there is an error in `projectService` it gets logged to the console as
75
67
#### When you break atom-typescript during development
76
68
This shouldn't happen as long as you leave the `atom-typescript` window untouched and do testing in another atom instance. If you reload the `atom-typescript` window thinking its going to be stable but it turns out to be unstable do one of the following:
77
69
* Discard the *JavaScript* changes that you think broke it and reload the atom instance.
78
-
* Run `grunt` and leave it running to compile your atomts changes (as atomts is going to be out of order)
79
-
* Open up the visual studio project (at your own risk, we do not keep this up to date!)
80
-
81
-
## Architecture
82
-
We wrap the `languageService` + our custom `languageServiceHost` + [`projectFile`](https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md) into a `Project` (code in `Project.ts` in the `lang` folder). The functions that interact with this `project` are exposed from `projectService` ([the query / response section](https://github.com/TypeStrong/atom-typescript/blob/6fbf860eaf971baa3aca939626db553898cb40db/lib/main/lang/projectService.ts#L58-L244)). `projectService` is where you would add new features that interact with the language service. All this code is `sync` and can be tested / run on any node instance. Be careful not to *leave*`console.log` in this code (as we use `stdio` to make this code `async`) or use `atom` specific APIs (as it may not be in the UI thread).
83
-
84
-
We make this code `async`(and promise based) by:
85
-
***Single line:** (e.g. `export var echo = childQuery(projectService.echo);`) for every new call to get good compile time safety ([see the code in `parent.ts`](https://github.com/TypeStrong/atom-typescript/blob/b0a862cf209d18982875d5c38e3a655594316e9a/lib/worker/parent.ts#L148-L158)).
86
-
87
-
### Additional Notes:
88
-
*`childQuery` takes the signature of the `sync` function from `projectService` of the form `Query->Response` and automatically creates an `async` function of the form `Query->Promise<Response>`. The function body from `projectService` is not used, just the function *name* and the *type information* is.
89
-
* We automatically add all functions exported from `projectService` in the list of functions that the child uses to respond to by name. ([see code in `child.ts`](https://github.com/TypeStrong/atom-typescript/blob/b0a862cf209d18982875d5c38e3a655594316e9a/lib/worker/child.ts#L48-L51)). Here we are not concerned with the *type information*. Instead we will actively *call the function* added to responders by *name*.
90
-
* We spawn a separate `atom` (or `node` on windows) instance and use `ipc` ([see code in `parent.ts`](https://github.com/TypeStrong/atom-typescript/blob/b0a862cf209d18982875d5c38e3a655594316e9a/lib/worker/parent.ts#L4-L141)). Also [reason for not using WebWorkers](https://github.com/atom/atom-shell/issues/797).
91
-
92
-
Advantage: you only need to define the query/response interface once (in `projectService.ts`) and write it in a testable `sync` manner. The parent code is never out of sync from the function definition (thanks to `childQuery`). Adding new functions is done is a typesafe way as you would write any other sync function + additionally using only one additional line of code in `parent.ts` (`childQuery`).
93
70
94
71
## Language Service Documentation
95
72
The TypeScript Language service docs: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
73
+
The `tsserver` protocol definitions https://github.com/Microsoft/TypeScript/blob/master/lib/protocol.d.ts
96
74
97
75
## Showing errors in atom
98
76
Done using the `linter` plugin. If you think about it. TypeScript is really just a super powerful version of `jshint` and that is the reason to use `linter` for errors.
@@ -101,17 +79,3 @@ Just look at `linter.ts` in our code.
101
79
## Grammar
102
80
103
81
Please see https://github.com/TypeStrong/atom-typescript/tree/master/docs/grammar.md
104
-
105
-
106
-
## QuickFix
107
-
The quickest way is to copy an existing one located in the [quick fix directory](https://github.com/TypeStrong/atom-typescript/tree/a91f7e0c935ed2bdc2c642350af50a7a5aed70ad/lib/main/lang/fixmyts/quickFixes). Copy one of these files into a new quick fix.
108
-
109
-
Quick fixes need to implement the `QuickFix` interface ([code here](https://github.com/TypeStrong/atom-typescript/blob/a91f7e0c935ed2bdc2c642350af50a7a5aed70ad/lib/main/lang/fixmyts/quickFix.ts#L46-L53)).
110
-
111
-
Once you have the quickfix created just put it into the [quickfix registry](https://github.com/TypeStrong/atom-typescript/blob/a91f7e0c935ed2bdc2c642350af50a7a5aed70ad/lib/main/lang/fixmyts/quickFixRegistry.ts#L14-L24) so that the infrastructure picks it up.
112
-
113
-
**Additional Tips** : One indespensible tool when creating a quick fix is the [AST viewer](https://github.com/TypeStrong/atom-typescript#ast-visualizer) which allows you to investigate the TypeScript language service view of the file.
114
-
115
-
# Video
116
-
117
-
A video on some of the internals : https://www.youtube.com/watch?v=WOuNb2MGR4o
Copy file name to clipboardExpand all lines: README.md
+5-135Lines changed: 5 additions & 135 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,11 @@
1
-
# Beta
2
-
3
-
This is a fork of the `atom-typescript` package with a very different implementation and, necessarily, different user experience. More info here: https://github.com/TypeStrong/atom-typescript/pull/1166
4
-
5
1
# Atom TypeScript
6
2
7
3
[](https://gitter.im/TypeStrong/atom-typescript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
4
9
5
JavaScript developers can now just open a `.ts` file and start hacking away like they are used to. No `grunt` no `Visual Studio`. Just pure coding.
10
6
7
+
**NOTE**: This branch contains a major rewrite (**v11**) of the `atom-typescript` plugin that is lighter and faster, but lacks a few major features that you might miss. The previous version is still available in the `legacy` branch and will containue to receive minor bugfixes, but I wouldn't count on any new developments.
8
+
11
9
## Installation
12
10
13
11
1. Install [atom](https://atom.io).
@@ -34,25 +32,11 @@ JavaScript developers can now just open a `.ts` file and start hacking away like
34
32
* Project Context Support (`tsconfig.json`)
35
33
* Project Build Support
36
34
*`package.json` Support
37
-
* Format code (configurable to be on save)
38
35
* Goto Declaration
39
36
* Find References
40
37
* Block comment and uncomment
41
-
* Goto history (goto next/previous error in open files, goto next/previous build)
Located online : https://github.com/TypeStrong/atom-typescript/blob/master/docs/faq.md
@@ -63,148 +47,34 @@ Located online : https://github.com/TypeStrong/atom-typescript/blob/master/docs/
63
47
## Auto Complete
64
48
Internally using AutoComplete+. Just start typing and hints will show up. Or you can explicitly trigger it using `ctrl+space` or `cmd+space`. Press `tab` to make a selection.

73
54
74
55
## Compile on save
75
-
TypeScript files will be compiled on save automatically. Different notifications are given if `emit` was successful or not. If you need to disable this feature, add `"compileOnSave": false` in your [`tsconfig.json`](https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#compileonsave).
When `"compileOnSave": true` is set in `tsconfig.json`, Typescript files will be compiled and saved automatically. The compiler does its best to emit something, even if there are semantic errors in the file.
82
57
83
58
## Project Support
84
-
Supported via [`tsconfig.json`](https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md) which is going to be the defacto Project file format for the next versions of TypeScript.
85
-
86
-
It also supports `filesGlob` which will expand `files` for you based on `minmatch|glob|regex` (similar to grunt).
We have a sample NPM module : https://github.com/basarat/ts-npm-module (trick : in tsconfig have `"declaration" : true` an in package.json have a `typings` field pointing to the `main` file) and its usage is demoed in https://github.com/basarat/ts-npm-module-consume.
99
-
100
-
### Configuration tips
101
-
102
-
Covered here : http://basarat.gitbooks.io/typescript/content/docs/jsx/tsx.html
`atom-typescript` supports all the same options the Typescript compiler does as it's using it behind the scenes to do all of the heavy lifting. In fact, `atom-typescript` will use the exact version of Typescript you have installed in your `node_modules` directory.
107
60
108
61
## Format Code
109
62
Shortcut : `ctrl+alt+l` or `cmd+alt+l`. Will format just the selection if you have something selected otherwise it will format the entire file.
110
63
111
-
Format on save is covered [here](https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#formatOnSave)
112
-
113
64
## Go to Declaration
114
65
Shortcut : `F12`. Will open the *first* declaration of the said item for now. (Note: some people call it Go to Definition)
`ctrl+/` or `cmd+/`. Does a block comment / uncomment of code.
123
-
124
-
## Go to Next / Go to Previous
125
-
`f8` and `shift+f8` respectively. This will go to next/previous *errors in open files* OR *build error* OR *references* based on which tab you have selected.
126
-
127
-
## Context menu
128
-
Quickly toggle the TypeScript panel OR select active TypeScript panel tab and other stuff using the context menu. `ctrl+;` or `cmd+;`.
129
-
130
-
## Symbols View
131
-
Integrates with atom's symbols view (`ctrl+r` or `cmd+r`) to provide you with a list of searchable symbols in the current file.
A bird's eye view of the current file. Use command `toggle semantic view`. The view updates while you edit the code. You can also click to jump to any portion of the file.
Also called Go To Type in other IDEs. Integrates with atom's project level symbols (`ctrl+shift+r` or `cmd+shift+r`) to provide you with a list of searchable symbols in the *entire typescript project*.
Press the `TypeScript: Quick Fix` shortcut `alt+enter` at an error location to trigger quick fixes. Select the quick fix you want and press `enter` to commit e.g
We are actively adding quick fixes so [**go here for an up to date list**](https://github.com/TypeStrong/atom-typescript/blob/master/docs/quickfix.md).
159
-
160
-
## Toggle Breakpoint
161
-
Use command `TypeScript: Toggle Breakpoint` shortcut `f9`:
Note that within the path string you get autocomplete (`ctrl+space`/`cmd+space`) for all the files in the project by filename (works for both `ref` and `import`).
Command : `Typescript: Dependency View`. A dependency viewer for insight into the project if you use external modules. You can zoom, pan, drag points around and hover over nodes. ([more details](https://github.com/TypeStrong/atom-typescript/blob/master/docs/dependency-view.md))
We try to keep as much of the stuff in sync while you edit code. However *in dire circumstances*:
203
-
204
-
* a soft sync is done when you save a file `ctrl+s` and we will completely reprocess the *active* file. This might not fix stuff if the error is because of *some other file on the file system*.
205
-
*`ctrl+'` or `cmd+'` : If you deleted files in the background or renamed them or jumped git branches or *something weird just happened* then sync. No need to restart your IDE :).
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,9 @@ We only plan to *strictly* document the breaking changes. The rest is optional.
5
5
# Planned
6
6
(No breaking changes staged)
7
7
8
+
# v11.0.0
9
+
* Major rewrite using `tsserver` API for the best compatibility with the current versions of Typescript.
10
+
8
11
# v7.0.0
9
12
* Removed the (already ignored in any significant way) `version` option from tsconfig. [More](https://github.com/TypeStrong/atom-typescript/issues/617)
10
13
@@ -32,4 +35,3 @@ We only plan to *strictly* document the breaking changes. The rest is optional.
0 commit comments