Skip to content

Commit c47dff9

Browse files
authored
Mention Flow in readme (#87)
1 parent 31a3f06 commit c47dff9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,46 @@ To sort or remove unused imports you can trigger the `LSP-typescript: Organize I
2626
}
2727
},
2828
```
29+
30+
### Usage in projects that also use Flow
31+
32+
TypeScript can [check vanilla JavaScript](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html), but may break on JavaScript with Flow types in it. To keep LSP-typescript enabled for TS and vanilla JS, while ignoring Flow-typed files, you must install [JSCustom](https://packagecontrol.io/packages/JSCustom) and configure it like so:
33+
34+
```json
35+
{
36+
"configurations": {
37+
"Flow": {
38+
"scope": "source.js.flow",
39+
"flow_types": true,
40+
"jsx": true
41+
}
42+
}
43+
}
44+
```
45+
46+
Also install [ApplySyntax](https://packagecontrol.io/packages/ApplySyntax) and configure it like so:
47+
48+
```json
49+
{
50+
"syntaxes": [
51+
{
52+
"syntax": "User/JS Custom/Syntaxes/Flow",
53+
"match": "all",
54+
"rules": [
55+
{ "file_path": ".*\\.jsx?$" },
56+
{ "first_line": "^/[/\\*] *@flow" }
57+
]
58+
}
59+
]
60+
}
61+
```
62+
63+
And then configure LSP-typescript like so:
64+
65+
```json
66+
{
67+
"selector": "source.js - source.js.flow, source.jsx, source.ts, source.tsx"
68+
}
69+
```
70+
71+
This works only on Sublime Text 4, and your project must have a `// @flow` or `/* @flow */` in each Flow-typed file. For more information, see [this issue](https://github.com/sublimelsp/LSP-typescript/issues/60).

0 commit comments

Comments
 (0)