Skip to content

Commit 714bd97

Browse files
committed
Clean up the docs and revert -beta naming
1 parent 09eda74 commit 714bd97

22 files changed

+21
-627
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ Some shortcuts:
5757
* `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.
5858
* `ctrl+alt+r` will reload the entire atom instance.
5959

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-
6860
### General Steps
6961
1. We open `atom-typescript` in one atom window
7062
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
7567
#### When you break atom-typescript during development
7668
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:
7769
* 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`).
9370

9471
## Language Service Documentation
9572
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
9674

9775
## Showing errors in atom
9876
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.
10179
## Grammar
10280

10381
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

README.md

Lines changed: 5 additions & 135 deletions
Original file line numberDiff line numberDiff 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-
51
# Atom TypeScript
62

73
[![Join the chat at https://gitter.im/TypeStrong/atom-typescript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/TypeStrong/atom-typescript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
84

95
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.
106

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+
119
## Installation
1210

1311
1. Install [atom](https://atom.io).
@@ -34,25 +32,11 @@ JavaScript developers can now just open a `.ts` file and start hacking away like
3432
* Project Context Support (`tsconfig.json`)
3533
* Project Build Support
3634
* `package.json` Support
37-
* Format code (configurable to be on save)
3835
* Goto Declaration
3936
* Find References
4037
* Block comment and uncomment
41-
* Goto history (goto next/previous error in open files, goto next/previous build)
42-
* Auto indent for new lines
43-
* TypeScript context menu
44-
* Symbols in Project
45-
* Symbols in File
46-
* Semantic View
4738
* Rename refactoring
48-
* Quick Fix
49-
* Toggle Breakpoint
5039
* Common Snippets
51-
* `import` / `/// <reference` relative path resolution
52-
* Output Toggle
53-
* AST visualizer
54-
* Dependency View
55-
* Sync
5640

5741
# FAQ
5842
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/
6347
## Auto Complete
6448
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.
6549

66-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/fastErrorCheckingAndAutoComplete2.gif)
67-
68-
6950
## Type information on hover
7051
Just hover
7152

7253
![you definitely get the point](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/hover.png)
7354

7455
## 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).
76-
77-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/compile%20success.png)
78-
79-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/compile%20error.png)
80-
81-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/emit%20error.png)
56+
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.
8257

8358
## 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).
87-
88-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/proj.png)
89-
90-
### Project Build Support
91-
Shortcut: `F6`. If there are any errors they are shown as well.
92-
93-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/build%20success.png)
94-
95-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/build%20errors.png)
96-
97-
## NPM Module Support
98-
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
103-
104-
### Html to TSX
105-
106-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/htmltotsx.gif)
59+
`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.
10760

10861
## Format Code
10962
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.
11063

111-
Format on save is covered [here](https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#formatOnSave)
112-
11364
## Go to Declaration
11465
Shortcut : `F12`. Will open the *first* declaration of the said item for now. (Note: some people call it Go to Definition)
11566

11667
## Find References
11768
Shortcut `shift+F12`. Also called *find usages*.
11869

119-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/findReferences.png)
120-
121-
## Block Comment and Uncomment
122-
`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.
132-
133-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/symbolsView.gif)
134-
135-
## Semantic View
136-
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.
137-
138-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/semanticView.png)
139-
140-
## Project Symbols View
141-
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*.
142-
143-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/projectSymbolView.png)
144-
14570
## Refactoring
14671

14772
### Rename
14873
`f2` to initiate rename. `enter` to commit and `esc` to cancel.
14974
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript/master/docs/screens/renameRefactoring.png)
15075

15176
## Quick Fix
152-
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
153-
154-
### Add class members
155-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/addClassMember.gif)
156-
157-
### More Quick fixes
158-
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`:
162-
163-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/toggleBreakpoint.gif)
164-
165-
## tsconfig validation
166-
We will validate it and help you to fix it :)
167-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/errorcases/invalidProjectOptions/invalidProjectOptions.gif)
168-
169-
## Snippets
170-
### Relative Paths
171-
Relative paths have traditionally been a pain, not anymore. Use `import` or `ref` and press `tab` to trigger snippet.
172-
173-
`ref`
174-
175-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/ref%20snippet.gif)
176-
177-
`import`
178-
179-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/import%20snippet.gif)
180-
181-
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`).
182-
183-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/pathChange.gif)
184-
185-
## Output Toggle
186-
`ctrl+shift+m` to toggle the output co**m**piled JS file for a give TypeScript file. The keyboard shortcut is consistent with atom's markdown preview.
187-
188-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/outputToggle.gif)
189-
190-
## AST Visualizer
191-
Command : `Typescript: Ast`. Useful when authoring new features.
192-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/astVisualizer.gif)
193-
194-
Also command : `TypeScript: Ast Full` that includes the `trivia` (punctuation, comments etc. received from `ts.Node.getChildren()`) as well.
195-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/astFull.png)
196-
197-
## Dependency View
198-
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))
199-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/dependencyView/teaser.png)
200-
201-
## Sync
202-
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 :).
206-
207-
![](https://raw.githubusercontent.com/TypeStrong/atom-typescript-examples/master/screens/sync.gif)
77+
Current iteration of the plugin doesn't support any Quickfixes, but they're coming in the future.
20878

20979
## Contributing
21080

dist/main/atomts.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
const tslib_1 = require("tslib");
44
const Atom = require("atom");
55
const atomConfig = require("./atom/atomConfig");
6-
const hyperclickProvider = require("../hyperclickProvider");
76
const tsconfig = require("tsconfig/dist/tsconfig");
87
const renameView_1 = require("./atom/views/renameView");
98
const autoCompleteProvider_1 = require("./atom/autoCompleteProvider");
@@ -26,7 +25,7 @@ const commands_1 = require("./atom/commands");
2625
let linter;
2726
let statusBar;
2827
function activate(state) {
29-
require('atom-package-deps').install('atom-typescript-beta', true).then(() => {
28+
require('atom-package-deps').install('atom-typescript', true).then(() => {
3029
let statusPriority = 100;
3130
for (const panel of statusBar.getRightTiles()) {
3231
if (panel.getItem().tagName === "GRAMMAR-SELECTOR-STATUS") {
@@ -141,10 +140,6 @@ function provide() {
141140
];
142141
}
143142
exports.provide = provide;
144-
function getHyperclickProvider() {
145-
return hyperclickProvider;
146-
}
147-
exports.getHyperclickProvider = getHyperclickProvider;
148143
function loadProjectConfig(sourcePath) {
149144
return exports.clientResolver.get(sourcePath).then(client => {
150145
return client.executeProjectInfo({ needFileNameList: false, file: sourcePath }).then(result => {

docs/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ We only plan to *strictly* document the breaking changes. The rest is optional.
55
# Planned
66
(No breaking changes staged)
77

8+
# v11.0.0
9+
* Major rewrite using `tsserver` API for the best compatibility with the current versions of Typescript.
10+
811
# v7.0.0
912
* Removed the (already ignored in any significant way) `version` option from tsconfig. [More](https://github.com/TypeStrong/atom-typescript/issues/617)
1013

@@ -32,4 +35,3 @@ We only plan to *strictly* document the breaking changes. The rest is optional.
3235

3336
# 0.x
3437
* Initial releases
35-

docs/dependency-view.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)