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)
|
||||
|
||||
let isUserSelect = false
|
||||
let didUserType = false
|
||||
let isRelevant = viewUpdate.docChanged
|
||||
for (const tr of viewUpdate.transactions) {
|
||||
if (tr.isUserEvent('select')) {
|
||||
isUserSelect = true
|
||||
} else if (tr.isUserEvent('input')) {
|
||||
isRelevant = true
|
||||
didUserType
|
||||
} else if (tr.isUserEvent('delete')) {
|
||||
isRelevant = true
|
||||
} 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
|
||||
// highlighted.
|
||||
if (isUserSelect) {
|
||||
if (isUserSelect || didUserType) {
|
||||
this._deffererUserSelect(true)
|
||||
return
|
||||
}
|
||||
|
||||
@ -131,8 +131,8 @@ export function getNodeFromPath<T>(
|
||||
if (
|
||||
typeof stopAt !== 'undefined' &&
|
||||
(isArray(stopAt)
|
||||
? stopAt.includes(currentNode.type)
|
||||
: currentNode.type === stopAt)
|
||||
? stopAt.includes(currentNode?.type)
|
||||
: currentNode?.type === stopAt)
|
||||
) {
|
||||
// it will match the deepest node of the type
|
||||
// instead of returning at the first match
|
||||
|
||||
Reference in New Issue
Block a user