[atom] Add some missing definitions mentioned in #22211

This commit is contained in:
Nikolay Yakimov
2017-12-17 02:17:54 +03:00
parent 87fe42183e
commit 0c842ceefe
2 changed files with 34 additions and 1 deletions
+18
View File
@@ -196,6 +196,8 @@ function testAtomEnvironment() {
}
atom.executeJavaScriptInDevTools("Test");
const path: string = atom.getConfigDirPath();
}
// BufferedNodeProcess ========================================================
@@ -1056,6 +1058,10 @@ function testGrammar() {
tokenizeLineResult.tokens;
grammar.tokenizeLine("Test String", tokenizeLineResult.ruleStack);
grammar.tokenizeLine("Test String", tokenizeLineResult.ruleStack, false);
let str: string;
str = grammar.name;
str = grammar.scopeName;
}
// GrammarRegistry ============================================================
@@ -1396,6 +1402,9 @@ function testPackageManager() {
subscription = atom.packages.onDidDeactivatePackage(pack => pack.path);
subscription = atom.packages.onDidLoadPackage(pack => pack.isCompatible());
subscription = atom.packages.onDidUnloadPackage(pack => pack.name);
subscription = atom.packages.onDidTriggerActivationHook(
'language-javascript:grammar-used', () => {}
);
// Package system data
str = atom.packages.getApmPath();
@@ -2922,6 +2931,15 @@ function testTextEditor() {
// TextEditor Rendering
str = editor.getPlaceholderText();
editor.setPlaceholderText("Test");
range = editor.bufferRangeForScopeAtPosition('source.js', [0, 0]);
range = editor.bufferRangeForScopeAtPosition('source.js', {row: 10, column: 11});
range = editor.bufferRangeForScopeAtPosition('source.js', pos);
let token: {value: string, scopes: string[]};
token = editor.tokenForBufferPosition([5, 6]);
token = editor.tokenForBufferPosition({row: 0, column: 1});
token = editor.tokenForBufferPosition(pos);
}
// ThemeManager ===============================================================
+16 -1
View File
@@ -238,6 +238,9 @@ export interface AtomEnvironment {
/** Execute code in dev tools. */
executeJavaScriptInDevTools(code: string): void;
/** Undocumented: get Atom config directory path */
getConfigDirPath(): string;
}
/**
@@ -2379,6 +2382,12 @@ export class TextEditor {
* displayed when the editor has no content.
*/
setPlaceholderText(placeholderText: string): void;
/** Undocumented: Buffer range for syntax scope at position */
bufferRangeForScopeAtPosition(scope: string, point: PointCompatible): Range;
/** Undocumented: Get syntax token at buffer position */
tokenForBufferPosition(pos: PointCompatible): {value: string, scopes: string[]};
}
/** Experimental: This global registry tracks registered TextEditors. */
@@ -3610,7 +3619,10 @@ export class GitRepository {
/** Grammar that tokenizes lines of text. */
export interface Grammar {
/** The name of the Grammar. */
name: string;
readonly name: string;
/** Undocumented: scope name of the Grammar. */
readonly scopeName: string;
// Event Subscription
onDidUpdate(callback: () => void): Disposable;
@@ -3938,6 +3950,9 @@ export interface PackageManager {
/** Invoke the given callback when a package is unloaded. */
onDidUnloadPackage(callback: (package: Package) => void): Disposable;
/** Undocumented: invoke the given callback when an activation hook is triggered */
onDidTriggerActivationHook(hook: string, callback: () => void): Disposable;
// Package System Data
/** Get the path to the apm command. */
getApmPath(): string;