stop path to node from getting stale
This commit is contained in:
@ -64,12 +64,14 @@ export class KclPlugin implements PluginValue {
|
|||||||
editorManager.setEditorView(viewUpdate.view)
|
editorManager.setEditorView(viewUpdate.view)
|
||||||
|
|
||||||
let isUserSelect = false
|
let isUserSelect = false
|
||||||
|
let didUserType = false
|
||||||
let isRelevant = viewUpdate.docChanged
|
let isRelevant = viewUpdate.docChanged
|
||||||
for (const tr of viewUpdate.transactions) {
|
for (const tr of viewUpdate.transactions) {
|
||||||
if (tr.isUserEvent('select')) {
|
if (tr.isUserEvent('select')) {
|
||||||
isUserSelect = true
|
isUserSelect = true
|
||||||
} else if (tr.isUserEvent('input')) {
|
} else if (tr.isUserEvent('input')) {
|
||||||
isRelevant = true
|
isRelevant = true
|
||||||
|
didUserType
|
||||||
} else if (tr.isUserEvent('delete')) {
|
} else if (tr.isUserEvent('delete')) {
|
||||||
isRelevant = true
|
isRelevant = true
|
||||||
} else if (tr.isUserEvent('undo')) {
|
} else if (tr.isUserEvent('undo')) {
|
||||||
@ -108,7 +110,7 @@ export class KclPlugin implements PluginValue {
|
|||||||
|
|
||||||
// If we have a user select event, we want to update what parts are
|
// If we have a user select event, we want to update what parts are
|
||||||
// highlighted.
|
// highlighted.
|
||||||
if (isUserSelect) {
|
if (isUserSelect || didUserType) {
|
||||||
this._deffererUserSelect(true)
|
this._deffererUserSelect(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,8 +131,8 @@ export function getNodeFromPath<T>(
|
|||||||
if (
|
if (
|
||||||
typeof stopAt !== 'undefined' &&
|
typeof stopAt !== 'undefined' &&
|
||||||
(isArray(stopAt)
|
(isArray(stopAt)
|
||||||
? stopAt.includes(currentNode.type)
|
? stopAt.includes(currentNode?.type)
|
||||||
: currentNode.type === stopAt)
|
: currentNode?.type === stopAt)
|
||||||
) {
|
) {
|
||||||
// it will match the deepest node of the type
|
// it will match the deepest node of the type
|
||||||
// instead of returning at the first match
|
// instead of returning at the first match
|
||||||
|
|||||||
Reference in New Issue
Block a user