How to use the sourcegraph.MarkupKind function in sourcegraph

To help you get started, we’ve selected a few sourcegraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / travisGo.ts View on Github external
switchMap<[URL, sourcegraph.Diagnostic[]][], Promise>(async diagnostics => ({
                        title: 'Travis CI',
                        state: {
                            completion: sourcegraph.CheckResult.Completed,
                            result: sourcegraph.CheckResult.Success,
                            message: 'All builds passing, all repository configuration valid and up-to-date',
                        },
                        sections: {
                            settings: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `Require all projects to configure Travis CI`,
                            },
                            notifications: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `Notify **@sourcegraph/devops** of changes to Travis CI configuration`,
                            },
                        },
                        diagnostics: diagnosticCollection,
                    })),
                    startWith({
github sourcegraph / sourcegraph-basic-code-intel / package / src / lsif.ts View on Github external
hover: { markdown: { text: string }; range: sourcegraph.Range }
    }>({
        doc,
        query,
        position,
    })

    if (!lsifObj) {
        return undefined
    }

    return {
        value: {
            contents: {
                value: lsifObj.hover.markdown.text,
                kind: sourcegraph.MarkupKind.Markdown,
            },
            range: lsifObj.hover.range,
        },
    }
}
github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / eslint.ts View on Github external
message: 'Running ESLint...',
                                  }
                                : {
                                      completion: sourcegraph.CheckCompletion.Completed,
                                      result:
                                          diagnostics.length > 0
                                              ? sourcegraph.CheckResult.Failure
                                              : sourcegraph.CheckResult.Success,
                                      message:
                                          diagnostics.length > 0
                                              ? 'ESLint problems found'
                                              : 'Code is compliant with ESLint',
                                  },
                        sections: {
                            settings: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `
- Use \`eslint@6.0.1\`
- Check for new, recommended ESLint rules
- Ignore projects with only JavaScript files`,
                            },
                            /*notifications: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `
- Fail changesets that add code not checked by ESLint
- Notify **@felixfbecker** of new ESLint rules`,
                            },*/
                        },
                    }
                    return info
                })
            ),
github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / dependencyRules.ts View on Github external
result:
                                          diagnostics.length > 0
                                              ? sourcegraph.CheckResult.Failure
                                              : sourcegraph.CheckResult.Success,
                                      message:
                                          diagnostics.length > 0
                                              ? 'Unapproved npm dependencies found'
                                              : 'All in-use npm dependencies are approved',
                                  },
                        sections: {
                            settings: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `Require explicit approval for all npm dependencies`,
                            },
                            notifications: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `Fail changesets that add unapproved npm dependencies`,
                            },
                        },
                        notifications: sortBy(Array.from(deps.entries()), 0)
                            .filter(([, depStatus]) => depStatus !== DependencyStatus.Allowed)
                            .map(([depName, depStatus]) => ({
                                title:
                                    depStatus === DependencyStatus.Unreviewed
                                        ? `Unreviewed npm dependency in use: ${depName}`
                                        : `Forbidden npm dependency in use: ${depName}`,
                                type:
                                    depStatus === DependencyStatus.Unreviewed
                                        ? sourcegraph.NotificationType.Warning
                                        : sourcegraph.NotificationType.Error,
                            })),
                    }
github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / eslint.ts View on Github external
map(diagnostics => {
                    const info: sourcegraph.CheckInformation = {
                        description: {
                            kind: sourcegraph.MarkupKind.Markdown,
                            value: 'Checks code using ESLint, an open-source JavaScript linting utility.',
                        },
                        state:
                            diagnostics === LOADING
                                ? {
                                      completion: sourcegraph.CheckCompletion.InProgress,
                                      message: 'Running ESLint...',
                                  }
                                : {
                                      completion: sourcegraph.CheckCompletion.Completed,
                                      result:
                                          diagnostics.length > 0
                                              ? sourcegraph.CheckResult.Failure
                                              : sourcegraph.CheckResult.Success,
                                      message:
                                          diagnostics.length > 0
github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / travisGo.ts View on Github external
switchMap<[URL, sourcegraph.Diagnostic[]][], Promise>(async diagnostics => ({
                        title: 'Travis CI',
                        state: {
                            completion: sourcegraph.CheckResult.Completed,
                            result: sourcegraph.CheckResult.Success,
                            message: 'All builds passing, all repository configuration valid and up-to-date',
                        },
                        sections: {
                            settings: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `Require all projects to configure Travis CI`,
                            },
                            notifications: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `Notify **@sourcegraph/devops** of changes to Travis CI configuration`,
                            },
                        },
                        diagnostics: diagnosticCollection,
                    })),
                    startWith({
github sourcegraph / sourcegraph-extension-api / src / extension / extensionHost.ts View on Github external
const commands = new ExtCommands(proxy('commands'))
    handleRequests(connection, 'commands', commands)

    const storage = new ExtStorage(proxy('storage'))
    handleRequests(connection, 'storage', storage)

    const api: typeof sourcegraph = {
        URI,
        Position,
        Range,
        Selection,
        Location,
        MarkupKind: {
            PlainText: sourcegraph.MarkupKind.PlainText,
            Markdown: sourcegraph.MarkupKind.Markdown,
        },

        app: {
            get activeWindow(): sourcegraph.Window | undefined {
                return windows.getActive()
            },
            get windows(): sourcegraph.Window[] {
                return windows.getAll()
            },
            createPanelView: id => views.createPanelView(id),
        },

        workspace: {
            get textDocuments(): sourcegraph.TextDocument[] {
                return documents.getAll()
            },
github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / codeDuplication.ts View on Github external
map(diagnostics => {
                    const info: sourcegraph.CheckInformation = {
                        description: {
                            kind: sourcegraph.MarkupKind.Markdown,
                            value:
                                'Checks for code duplication using [**jscpd**](https://github.com/kucherenko/jscpd), a copy-paste detector with support for 150+ languages.',
                        },
                        state:
                            diagnostics === LOADING
                                ? {
                                      completion: sourcegraph.CheckCompletion.InProgress,
                                      message: 'Running jscpd...',
                                  }
                                : {
                                      completion: sourcegraph.CheckCompletion.Completed,
                                      result:
                                          diagnostics.length > 0
                                              ? sourcegraph.CheckResult.Failure
                                              : sourcegraph.CheckResult.Success,
                                      message:
github sourcegraph / sourcegraph / extensions / enterprise / check-search / src / codeDuplication.ts View on Github external
? {
                                      completion: sourcegraph.CheckCompletion.InProgress,
                                      message: 'Running jscpd...',
                                  }
                                : {
                                      completion: sourcegraph.CheckCompletion.Completed,
                                      result:
                                          diagnostics.length > 0
                                              ? sourcegraph.CheckResult.Failure
                                              : sourcegraph.CheckResult.Success,
                                      message:
                                          diagnostics.length > 0 ? 'Duplicated code found' : 'No duplicated code found',
                                  },
                        sections: {
                            settings: {
                                kind: sourcegraph.MarkupKind.Markdown,
                                value: `
- Use \`jscpd@2.0.15\`
- Ignore test code
- Ignore vendored code`,
                            },
                        },
                    }
                    return info
                })
            ),
github sourcegraph / sourcegraph / packages / extensions-client-common / src / api / extension / extensionHost.ts View on Github external
const search = new ExtSearch(proxy('search'))
    handleRequests(connection, 'search', search)

    const commands = new ExtCommands(proxy('commands'))
    handleRequests(connection, 'commands', commands)

    return {
        URI,
        Position,
        Range,
        Selection,
        Location,
        MarkupKind: {
            PlainText: sourcegraph.MarkupKind.PlainText,
            Markdown: sourcegraph.MarkupKind.Markdown,
        },

        app: {
            get activeWindow(): sourcegraph.Window | undefined {
                return windows.getActive()
            },
            get windows(): sourcegraph.Window[] {
                return windows.getAll()
            },
            createPanelView: id => views.createPanelView(id),
        },

        workspace: {
            get textDocuments(): sourcegraph.TextDocument[] {
                return documents.getAll()
            },