mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
Update a few stragglers for the query property renaming
This commit is contained in:
parent
11e2f75b0c
commit
6846b9cef2
@ -1,6 +1,10 @@
|
||||
const CaptureOrganizer = require('./capture-organizer');
|
||||
const { Emitter } = require('atom');
|
||||
|
||||
function layerHasTagsQuery(layer) {
|
||||
return layer.queries?.tagsQuery ?? layer.tagsQuery;
|
||||
}
|
||||
|
||||
class TreeSitterProvider {
|
||||
constructor() {
|
||||
this.packageName = 'symbol-provider-tree-sitter';
|
||||
@ -37,7 +41,7 @@ class TreeSitterProvider {
|
||||
}
|
||||
|
||||
// This provider needs at least one layer to have a tags query.
|
||||
let layers = languageMode.getAllLanguageLayers(l => !!l.tagsQuery);
|
||||
let layers = languageMode.getAllLanguageLayers(layerHasTagsQuery);
|
||||
if (layers.length === 0) {
|
||||
return false;
|
||||
}
|
||||
@ -64,13 +68,14 @@ class TreeSitterProvider {
|
||||
// The symbols-view package might've cancelled us in the interim.
|
||||
if (signal.aborted) return null;
|
||||
|
||||
let layers = languageMode.getAllLanguageLayers(l => !!l.tagsQuery);
|
||||
let layers = languageMode.getAllLanguageLayers(layerHasTagsQuery);
|
||||
if (layers.length === 0) return null;
|
||||
|
||||
for (let layer of layers) {
|
||||
let extent = layer.getExtent();
|
||||
|
||||
let captures = layer.tagsQuery.captures(
|
||||
let tagsQuery = layer.queries?.tagsQuery ?? layer.tagsQuery;
|
||||
let captures = tagsQuery.captures(
|
||||
layer.tree.rootNode,
|
||||
extent.start,
|
||||
extent.end
|
||||
|
@ -3290,7 +3290,7 @@ class LanguageLayer {
|
||||
// propagate errors.
|
||||
//
|
||||
// TODO: Warning?
|
||||
grammar.highlightsQuery = grammar.setQueryForTest(
|
||||
grammar.setQueryForTest(
|
||||
'highlightsQuery',
|
||||
`; (placeholder)`
|
||||
);
|
||||
@ -3753,8 +3753,8 @@ class LanguageLayer {
|
||||
}
|
||||
|
||||
getLocalReferencesAtPoint(point) {
|
||||
if (!this.localsQuery) { return []; }
|
||||
let captures = this.localsQuery.captures(
|
||||
if (!this.queries.localsQuery) { return []; }
|
||||
let captures = this.queries.localsQuery.captures(
|
||||
this.tree.rootNode,
|
||||
point,
|
||||
point + 1
|
||||
@ -3777,7 +3777,7 @@ class LanguageLayer {
|
||||
// EXPERIMENTAL: Given a local reference node, tries to find the node that
|
||||
// defines it.
|
||||
findDefinitionForLocalReference(node, captures = null) {
|
||||
if (!this.localsQuery) { return []; }
|
||||
if (!this.queries.localsQuery) { return []; }
|
||||
let name = node.text;
|
||||
if (!name) { return []; }
|
||||
let localRange = rangeForNode(node);
|
||||
@ -3785,7 +3785,7 @@ class LanguageLayer {
|
||||
|
||||
if (!captures) {
|
||||
captures = this.groupLocalsCaptures(
|
||||
this.localsQuery.captures(
|
||||
this.queries.localsQuery.captures(
|
||||
globalScope,
|
||||
globalScope.startPosition,
|
||||
globalScope.endPosition
|
||||
|
Loading…
Reference in New Issue
Block a user