Skip to content

Add TSNodeFinderVisitor#44

Merged
alesshosry merged 2 commits intoEvref-BL:mainfrom
jecisc:nodefinder
Mar 16, 2026
Merged

Add TSNodeFinderVisitor#44
alesshosry merged 2 commits intoEvref-BL:mainfrom
jecisc:nodefinder

Conversation

@jecisc
Copy link
Copy Markdown
Contributor

@jecisc jecisc commented Mar 13, 2026

This visitor allows one to look for a node matching a pattern and inspect it displaying its source code and its source code highlighted in the full source of the file.

Example of usage:

I wanted to find in python an except clause with multiple elements in the value field:

folder := '/Users/cyril/testPython/cpython-main/' asFileReference.

TSNodeFinderVisitor
	language: TSLanguage python
	extensions: #( 'py' )
	selection: [ :node |
			node type = #except_clause and: [
					node collectFieldNameOfNamedChild at: #value ifPresent: [ :nodes | nodes isCollection ] ifAbsent: [ false ] ] ]
	buildOn: folder.
image

jecisc added 2 commits March 13, 2026 17:06
This visitor allows one to look for a node matching a pattern and inspect it displaying its source code and its source code highlighted in the full source of the file.

Example of usage:

I wanted to find in python an except clause with multiple elements in the value field:

```st

folder := '/Users/cyril/testPython/cpython-main/' asFileReference.

TSNodeFinderVisitor
	language: TSLanguage python
	extensions: #( 'py' )
	selection: [ :node |
			node type = #except_clause and: [
					node collectFieldNameOfNamedChild at: #value ifPresent: [ :nodes | nodes isCollection ] ifAbsent: [ false ] ] ]
	buildOn: folder.
```
@alesshosry alesshosry merged commit e621baf into Evref-BL:main Mar 16, 2026
1 check passed
@jecisc jecisc deleted the nodefinder branch March 25, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants