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_only
built-in language name, which provides PHP language parsing without being encompassed within an outer HTML context (as thephp
built-in language is); this can be used for template languages which either embed or can be templatized by PHP).
CompletionContext
- Added the
matches
property.
ParseTreeMatch and ParseTreeCapture
- Added the
ParseTreeMatch
interface. - Added the
ParseTreeCapture
interface.
“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 valueany-not-eq?
: truthy if any captured node does not equal a valueany-contains?
: truthy if any captured node contains a valueany-not-contains?
: truthy if any captured node does not contain a valueany-match?
: truthy if any captured node matches a regexany-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 valueset-if-any-not-eq!
: sets a value if any captured node does not equal a valueset-if-any-contains!
: sets a value if any captured node contains a valueset-if-any-not-contains!
: sets a value if any captured node does not contain a valueset-if-any-match!
: sets a value if any captured node matches a regexset-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
Crypto
interface.
Environment
- Added the
crypto
property.
FileSystem
- Added the
tempdir
property.
Nova 9
Extension Manifest
- Added the
breakpoints
key. - Added the
debugAdapters
key.
DebugAdapterAction
- Added the
DebugAdapterAction
interface.
DebugSession
- Added the
DebugSession
interface.
DebugSessionCustomEvent
- Added the
DebugSessionCustomEvent
interface.
FileStats
- Added the
mode
property.
FileSystem
- Added the
chmod
method.
Workspace
- Added the
debugSessions
property. - Added the
previewRootPath
property. - Added the
previewURL
property. - Added the
onDidEndDebugSession
method. - Added the
onDidStartDebugSession
method. - Added the
previewURLForPath
method.
Nova 8
Path
- Added the
relative
method.
Nova 7
CompletionItem
- Added the
path
property.
Nova 6
Workspace
- Added the
path
option to theshowInputPalette
method.
Nova 5
AssistantsRegistry
- Added the
registerColorAssistant
method.
ColorCandidate
- Added the
ColorCandidate
interface.
ColorInformation
- Added the
ColorInformation
interface.
ColorInformationContext
- Added the
ColorInformationContext
interface.
ColorPresentation
- Added the
ColorPresentation
interface.
ColorPresentationContext
- Added the
ColorPresentationContext
interface.
Task
- Added the
buildBeforeRunning
property.
TaskActionResolveContext
- Added the
config
property.
Task Actions
- Added the
data
option to task action manifests. - Added the
resolve
option to task action manifests.
TextEditor
- Added the
moveUp
method. - Added the
moveDown
method. - Added the
moveLeft
method. - Added the
moveRight
method. - Added the
moveToTop
method. - Added the
moveToBottom
method. - Added the
moveToBeginningOfLine
method. - Added the
moveToEndOfLine
method. - Added the
moveToBeginningOfWord
method. - Added the
moveToEndOfWord
method.
TextEditorEdit
Nova 4
AssistantsRegistry
- Added the
resolveTaskAction
method.
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
TaskResolvableAction
interface.
TaskActionResolveContext
- Added the
TaskActionResolveContext
interface.
Nova 3
AssistantsRegistry
- Added the
triggerChars
property to the Completion Assistant Options.
Color
- Added the
ColorFormat
enumeration. - Added the
rgb
method. - Added the
hsl
method. - Added the
hsb
method. - Added the
displayP3
method.
CompletionContext
- Added the
identifierChars
property. - Added the
triggerCharacter
property.
ScopeSelector
- Added the
ScopeSelector
interface.
TaskCommandAction
- Added the
TaskCommandAction
interface.
Nova 2
Extension Manifest
- Added the
funding
key.
AssistantsRegistry
- Added the
registerTaskAssistant
method.
CompletionItem
- Added the
additionalTextEdits
property.
LanguageClient
- Added the
initializationOptions
option to theLanguageClient
constructor. - Added the
onDidStop
method.
Task
- Added the
Task
interface.
TaskProcessAction
- Added the
TaskProcessAction
interface.
TextEdit
- Added the
TextEdit
interface.
Nova 1.2
CompletionItem
- Added the
color
property. - Added the
insertTextFormat
property. - Deprecated the
tokenize
property.
Clipboard
- Added the
Clipboard
interface.
Environment
- Added the
clipboard
property.
TextEditor
- Added the
format
argument of theinsert
method.