Can Atom-IDE search nodes with matching (nested) properties?


#1

In particular, I want to make support for a data format based on YAML/JSON and to enable searching nodes/objects with specific attributes (one or more, matching string/regexps) and optionally replacing some other attribute.

Perhaps, I should implement custom panel/dialog for this.

But I don’t see anything useful in language server protocol.


#2

Why do you feel that the language server protocol is important for what you want to do? If you are just searching inside your code files for regular expressions in one or two languages, you don’t need to mess with any LSP-related stuff.


#3

Because regexs are not good for structures and I dont want to mess incorporating language syntax in regex.
I believe that LSP should help to deal with ast.


#4

Regex should work fine as a quick and simple tool.

If you really want it to be precise, you could alternatively write a tree-sitter parser for it. That gives you the syntax tree, and is easily extended to give syntax highlighting.


#5

The synttax tree is indeed what I expect in language-server and LSP. But I dont see any support for that.

Should I invent my own LSP to deal with syntax tree?


#6

I don’t even know what you’re doing. From

I want to make support for a data format based on YAML/JSON

I gathered you’re using an small language, that probably doesn’t have any existing support from anyone, and from

enable searching nodes/objects with specific attributes (one or more, matching string/regexps)

You want a way to find certain patterns. My understanding of LSP is it’s a connection between Atom and the “external programs”, not a parser itself. It just lets the two programs communicate.

So to get it to work, you still need to either 1) adapt an exisitng parser to be compatible, or 2) write the parsing stuff in a way that is compatible with LSP and/or Atom. One possibility I mentioned was tree-sitter, which lets you write a CFG for the language. You can then apply it to the text, and generate the syntax tree.

Packages like linter support dialog boxes with custom buttons. This may be what you want.