diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 4bfcfe11cb..28b93c73a8 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -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 =============================================================== diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index a7398cba18..24b24c9423 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -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;