Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace languages

Index

Functions

  • Compute the match between a document selector and a document. Values greater than zero mean the selector matches the document.

    A match is computed according to these rules:

    1. When DocumentSelector is an array, compute the match for each contained DocumentFilter or language identifier and take the maximum value.
    2. A string will be desugared to become the language-part of a DocumentFilter, so "fooLang" is like { language: "fooLang" }.
    3. A DocumentFilter will be matched against the document by comparing its parts with the document. The following rules apply:
    4. When the DocumentFilter is empty ({}) the result is 0
    5. When scheme, language, or pattern are defined but one doesn’t match, the result is 0
    6. Matching against * gives a score of 5, matching via equality or via a glob-pattern gives a score of 10
    7. The result is the maximum value of each match

    Samples:

    // default document from disk (file-scheme)
    doc.uri; //'file:///my/file.js'
    doc.languageId; // 'javascript'
    match('javascript', doc); // 10;
    match({language: 'javascript'}, doc); // 10;
    match({language: 'javascript', scheme: 'file'}, doc); // 10;
    match('*', doc); // 5
    match('fooLang', doc); // 0
    match(['fooLang', '*'], doc); // 5

    // virtual document, e.g. from git-index
    doc.uri; // 'git:/my/file.js'
    doc.languageId; // 'javascript'
    match('javascript', doc); // 10;
    match({language: 'javascript', scheme: 'git'}, doc); // 10;
    match('*', doc); // 5

    Parameters

    Returns number

    A number >0 when the selector matches and 0 when the selector does not match.

  • Register a call hierarchy provider.

    Multiple provider can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a code action provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a code lens provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a color provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a completion provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and groups of equal score are sequentially asked for completion items. The process stops when one or many providers of a group return a result. A failing provider (rejected promise or exception) will not fail the whole operation.

    Parameters

    • selector: DocumentSelector

      A selector that defines the documents this provider is applicable to.

    • provider: CompletionItemProvider<CompletionItem>

      A completion provider.

    • Rest ...triggerCharacters: string[]

      Trigger completion when the user types one of the characters, like . or :.

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a declaration provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a definition provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a formatting provider for a document.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a document highlight provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and groups sequentially asked for document highlights. The process stops when a provider returns a non-falsy or non-failure result.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a document link provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a formatting provider for a document range.

    Note: A document range provider is also a document formatter which means there is no need to register a document formatter when also registering a range provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a semantic tokens provider for a document range.

    Note: If a document has both a DocumentSemanticTokensProvider and a DocumentRangeSemanticTokensProvider, the range provider will be invoked only initially, for the time in which the full document provider takes to resolve the first request. Once the full document provider resolves the first request, the semantic tokens provided via the range provider will be discarded and from that point forward, only the document provider will be used.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a document symbol provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a provider that locates evaluatable expressions in text documents. The editor will evaluate the expression in the active debug session and will show the result in the debug hover.

    If multiple providers are registered for a language an arbitrary provider will be used.

    Parameters

    Returns Disposable

    A Disposable that unregisters this provider when being disposed.

  • Register a folding range provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. If multiple folding ranges start at the same position, only the range of the first registered provider is used. If a folding range overlaps with an other range that has a smaller position, it is also ignored.

    A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a hover provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register an implementation provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a inlay hints provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A Disposable that unregisters this provider when being disposed.

  • Registers an inline completion provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A Disposable that unregisters this provider when being disposed.

  • Register a provider that returns data for the debugger's 'inline value' feature. Whenever the generic debugger has stopped in a source file, providers registered for the language of the file are called to return textual data that will be shown in the editor at the end of lines.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A Disposable that unregisters this provider when being disposed.

  • Register a linked editing range provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider that has a result is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A Disposable that unregisters this provider when being disposed.

  • Register a formatting provider that works on type. The provider is active when the user enables the setting editor.formatOnType.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    • selector: DocumentSelector

      A selector that defines the documents this provider is applicable to.

    • provider: OnTypeFormattingEditProvider

      An on type formatting edit provider.

    • firstTriggerCharacter: string

      A character on which formatting should be triggered, like }.

    • Rest ...moreTriggerCharacter: string[]

      More trigger characters.

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a reference provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a reference provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a selection range provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a type definition provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

  • Register a workspace symbol provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.