Documentation Release Notes
This document outlines changes to the extension APIs by Nova version number.
Nova 12
Tree-sitter
- Added several additional predicates and directives (see the individual sections detailed below).
- Added the php_onlybuilt-in language name, which provides PHP language parsing without being encompassed within an outer HTML context (as thephpbuilt-in language is); this can be used for template languages which either embed or can be templatized by PHP).
CompletionContext
- Added the matchesproperty.
ParseTreeMatch and ParseTreeCapture
- Added the ParseTreeMatchinterface.
- Added the ParseTreeCaptureinterface.
“Any” Query Predicates / Directives
A new set of “any” predicates / directives have been implemented for Tree-sitter queries. These are useful when working with captures which might match multiple parse tree nodes, such as on nodes using the regex-style * and + operators.
These will evaluate true if any of the nodes which are captured match, and act as counterparts to the existing “non-any” versions, which only evaluate true if all captured nodes match.
Predicates
- any-eq?: truthy if any captured node equals a value
- any-not-eq?: truthy if any captured node does not equal a value
- any-contains?: truthy if any captured node contains a value
- any-not-contains?: truthy if any captured node does not contain a value
- any-match?: truthy if any captured node matches a regex
- any-not-match?: truthy if any captured node does not match a regex
Directives
- set-if-any-eq!: sets a value if any captured node equals a value
- set-if-any-not-eq!: sets a value if any captured node does not equal a value
- set-if-any-contains!: sets a value if any captured node contains a value
- set-if-any-not-contains!: sets a value if any captured node does not contain a value
- set-if-any-match!: sets a value if any captured node matches a regex
- set-if-any-not-match!: sets a value if any captured node does not match a regex
Query Metadata for Captures
The Nova 12 release brings new APIs to JavaScript Completions providers which allow an extension developer to collect metadata about a document’s parse tree from the Tree-sitter highlights queries of their language extension.
Language queries have previously had the capability to set metadata on a matched parse tree node by using the set*! family of directives. Such metadata was, until now, only utilized by Nova’s syntax engine as a way for queries to specify contextual info (such as for symbolication).
Now, metadata can also be set on specific captures of a match. To do this, a capture name can be specified immediately preceding the variable parameter of the directive. For directives which already take a capture parameter to compare (such as #set-if-eq!), the existing parameter is being renamed compareCapture in documentation to clarify. Otherwise, the behavior of these directives remains the same.
For example, using the following directive will set variableName to variableValue on the captured node @myNode, if the text of the node @nodeToCompare is foobar:
(#set-if-eq! @nodeToCompare "foobar" @myNode "variableName" "variableValue")
Completion Provider API for Query Metadata
Additionally, extensions vending a Completion Provider via JavaScript can now access the metadata applied by a language’s “highlights” query during a completion request. This should allow completion provider logic to access much richer parse tree information.
The CompletionContext type has a new matches property, which is an array of ParseTreeMatch objects matched during evaluation of the relevant language’s highlights query when a completion request is made at the cursor’s location.
Each ParseTreeMatch object in the array has two properties: metadata and captures. The metadata is a simple object mapping metadata variable keys to values. The captures is a simple object mapping capture names to ParseTreeCapture objects. Each capture object, in turn, has a metadata property (containing any metadata set on that capture), as well as text (the text captured) and range (the range of the captured node). Note: the text property is the final result which may have been transformed by query directives (such as prefix!); the range is the range of the original text.
For example, taking the directive used above, a completion provider can access the metadata like so:
provideCompletionItems(editor, context) {
    var items = [];
    let matches = context.matches;
    for match of matches {
      let value = match.captures["myNode"].metadata["variableValue"];
      if value == "variableValue" {
        // Do something interesting!
      }
    }
    return items;
}
Nova 11
Tree-sitter
- Added new query predicates: contains?,not-contains?,has-type?,not-has-type?,has-parent?,not-has-parent?,has-ancestor?,not-has-ancestor?,nth?,not-nth?.
Nova 10
Tree-sitter
- Added support for writing language extensions using Tree-sitter.
Crypto
- Added the Cryptointerface.
Environment
- Added the cryptoproperty.
FileSystem
- Added the tempdirproperty.
Nova 9
Extension Manifest
- Added the breakpointskey.
- Added the debugAdapterskey.
DebugAdapterAction
- Added the DebugAdapterActioninterface.
DebugSession
- Added the DebugSessioninterface.
DebugSessionCustomEvent
- Added the DebugSessionCustomEventinterface.
FileStats
- Added the modeproperty.
FileSystem
- Added the chmodmethod.
Workspace
- Added the debugSessionsproperty.
- Added the previewRootPathproperty.
- Added the previewURLproperty.
- Added the onDidEndDebugSessionmethod.
- Added the onDidStartDebugSessionmethod.
- Added the previewURLForPathmethod.
Nova 8
Path
- Added the relativemethod.
Nova 7
CompletionItem
- Added the pathproperty.
Nova 6
Workspace
- Added the pathoption to theshowInputPalettemethod.
Nova 5
AssistantsRegistry
- Added the registerColorAssistantmethod.
ColorCandidate
- Added the ColorCandidateinterface.
ColorInformation
- Added the ColorInformationinterface.
ColorInformationContext
- Added the ColorInformationContextinterface.
ColorPresentation
- Added the ColorPresentationinterface.
ColorPresentationContext
- Added the ColorPresentationContextinterface.
Task
- Added the buildBeforeRunningproperty.
TaskActionResolveContext
- Added the configproperty.
Task Actions
- Added the dataoption to task action manifests.
- Added the resolveoption to task action manifests.
TextEditor
- Added the moveUpmethod.
- Added the moveDownmethod.
- Added the moveLeftmethod.
- Added the moveRightmethod.
- Added the moveToTopmethod.
- Added the moveToBottommethod.
- Added the moveToBeginningOfLinemethod.
- Added the moveToEndOfLinemethod.
- Added the moveToBeginningOfWordmethod.
- Added the moveToEndOfWordmethod.
TextEditorEdit
Nova 4
AssistantsRegistry
- Added the resolveTaskActionmethod.
CompletionItem
- Added the following new constants to CompletionItemKind:Destructor,StaticMethod,StaticProperty,StylePseudoClass,StylePseudoElement,TagHead,TagTitle,TagMeta,TagLink,TagBody,TagScript,TagStyle,TagHeading,TagSection,TagContainer,TagUnorderedList,TagOrderedList,TagListItem,TagAnchor,TagImage,TagMedia,TagForm,TagFormField,TagFramework.
Symbol
- Added the following new symbol types: destructor,static-method,static-property
TaskResolvableAction
- Added the TaskResolvableActioninterface.
TaskActionResolveContext
- Added the TaskActionResolveContextinterface.
Nova 3
AssistantsRegistry
- Added the triggerCharsproperty to the Completion Assistant Options.
Color
- Added the ColorFormatenumeration.
- Added the rgbmethod.
- Added the hslmethod.
- Added the hsbmethod.
- Added the displayP3method.
CompletionContext
- Added the identifierCharsproperty.
- Added the triggerCharacterproperty.
ScopeSelector
- Added the ScopeSelectorinterface.
TaskCommandAction
- Added the TaskCommandActioninterface.
Nova 2
Extension Manifest
- Added the fundingkey.
AssistantsRegistry
- Added the registerTaskAssistantmethod.
CompletionItem
- Added the additionalTextEditsproperty.
LanguageClient
- Added the initializationOptionsoption to theLanguageClientconstructor.
- Added the onDidStopmethod.
Task
- Added the Taskinterface.
TaskProcessAction
- Added the TaskProcessActioninterface.
TextEdit
- Added the TextEditinterface.
Nova 1.2
CompletionItem
- Added the colorproperty.
- Added the insertTextFormatproperty.
- Deprecated the tokenizeproperty.
Clipboard
- Added the Clipboardinterface.
Environment
- Added the clipboardproperty.
TextEditor
- Added the formatargument of theinsertmethod.
| ← PreviousGetting Started | Next →Debug Adapters |