Skip to content

Commit 1f291d9

Browse files
committed
create editor typings
1 parent aacacd8 commit 1f291d9

File tree

6 files changed

+46
-3
lines changed

6 files changed

+46
-3
lines changed

lib/index.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Main from './main';
33
// React optimization
44
process.env.NODE_ENV = 'production';
55

6-
export let editor = {};
6+
export let editor;
77

88
const init = (ed) => {
99
editor = ed;

src/typings/editor/index.d.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interface IEditor {
2+
action: IEditorActions;
3+
directory: string;
4+
name: 'atom' | 'vscode';
5+
grammar: {
6+
getFromScope(scope: string): any;
7+
tokenizeLines(lines: string[]): any;
8+
};
9+
version: {
10+
minVersion: string;
11+
label: string;
12+
failMessage: string;
13+
isAboveVersion(a: string, b: string): boolean;
14+
};
15+
issuesPath: string;
16+
Subscription: any;
17+
addRightPanel: any;
18+
}
19+
20+
interface IEditorActions {
21+
toggleDevTools(): any;
22+
clearConsole(): any;
23+
openDevTools(): any;
24+
getEditor(): any;
25+
openFolder(): any;
26+
open(file: string, options?: Object): any;
27+
save(): any;
28+
scroll(content: string): any;
29+
set(text: string): any;
30+
insert(text: string, options?: Object): any;
31+
writeFileFromContent(obj: {
32+
to: string;
33+
content: string;
34+
dir: string;
35+
}): void;
36+
writeFileFromFile(obj: {
37+
to: string;
38+
from: string;
39+
dir: string;
40+
tutorialDir: string;
41+
}): void;
42+
}

src/typings/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
/// <reference path="globals/text-buffer/index.d.ts" />
3737
/// <reference path="tests/index.d.ts" />
3838
/// <reference path="tutorial/index.d.ts" />
39+
/// <reference path="editor/index.d.ts" />

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"src/typings/common/global.d.ts",
3838
"src/typings/common/index.d.ts",
3939
"src/typings/common/package-json.d.ts",
40+
"src/typings/editor/index.d.ts",
4041
"src/typings/globals/assertion-error/index.d.ts",
4142
"src/typings/globals/atom-plugin-command-line/index.d.ts",
4243
"src/typings/globals/atom/custom.d.ts",

0 commit comments

Comments
 (0)