Implementing IExtensionSnippet

To make a Snippet-related extension, you must implement the IExtensionSnippet interface in your Extension's main class:

import { Extension } from "@teamsqlio/ts-extension-sdk/dist/source/Extension";
import { IExtensionSnippet } from "@teamsqlio/ts-extension-sdk/dist/source/interfaces/groups/IExtensionSnippet"
import { Snippet } from "@teamsqlio/ts-extension-sdk/dist/source/snippet/Snippet"
import { DatabaseType } from "@teamsqlio/ts-extension-sdk/dist/source/enums/DatabaseType"

export class TeamSQLExtension extends Extension implements IExtensionSnippet {
    getSnippets(databaseName: string, schemaName: string): Array<Snippet> {
        let snippets = new Array<Snippet>();
        let insertText = `SELECT * FROM \`\${1:databaseName}\`.\`\${2:table_name}\` LIMIT 200;`;
        let label = "SELECT * FROM... (My Snippet)";
        let documentation = `Simple SELECT command`;
        let snippet = new Snippet(DatabaseType.MYSQL, label, insertText, documentation);
        return snippets;


-getSnippets(): Array<Snippet>

If you implement the IExtensionSnippet interface, it must return the Array<Snippet> object.

results matching ""

    No results matching ""