{
type: 'element',
tagName: 'div',
properties: {className: ['foo'], id: 'some-id'},
children: [
{
type: 'element',
tagName: 'span',
properties: {},
children: [
{type: 'ruby', value: 'some text'}
]
},
{
type: 'element',
tagName: 'span',
properties: {},
children: [
{
type: 'erb-loud', // <- comes from vscode-erb
value: { //prism return
type: "InstanceVariableReadNode",
location: [[1,0],[1,6]]
name: @posts,
}
]
},
{
type: 'erb-silent',
location: [[1,0],[1,6]],
value: {
},
children: [
{
type: "element", tagName: "h1", properties: {},
children: [
{type: "erb-loud", value: {}}
]
}
]
},
{
type: "element",
tagName: "span",
properties: {
id: '1',
},
dynamic_properties: [
{
type: "erb-silent",
children: [
{
type: "html-attr",
key: "class",
value: []
value: {
type: "composed",
children: [
{
type: "text",
value: "mt-2 "
},
{
type: "erb-loud",
value: {/* prism returned value */}
}
]
}
}
]
}
]
}
]
}
<span
id="1"
<% if post.title.length < 10 %>
class="mt-2 bg-red-200 border-t-[<%= post.read_percentage %>%]"
<% else %>
class="mt-0"
<%= %>
<% end %>
>
<%= post.description %>
</span>
<span id="1" <% if true %> class="mt-2 <%= post.title %>" <% end %> >
<%= post.description %>
</span>
<% @posts.each do |post| %>
<h1>
<%= post.title %>llll
</h1>
<% end %>
// 1. ide send file data to lsp server // 2. lsp server parse file data and return tree // 3. ide use tree to provide autocomplete
Parser.parse_html_erb("...") Parser.parse_html_blade("") Parser.oarse_html_ejs("")
<div {{ $attributes->merge(['data-controller' => 'this-should-autocomplete']) }}>
{{ $message }}
</div>
<div data-controller="autocomplete-works">
<%= @posts %>
<%= tag.div "Click", data: { controller: "autocomplete-doesn't-work"} %>
<%= content_tag(:span, "Click", data: { controller: "autocomplete-doesn't-work"} %>
</div>
any lang node would be send and the lang ast would be seperate for that node
{
type: 'element',
tagName: 'div',
properties: {className: ['foo'], id: 'some-id'},
children: [
{
type: 'element', // element, text, comment, lang
tagName: 'span',
properties: {},
children: [
{
type: "InstanceVariableReadNode",
location: [[1,0],[1,6]]
type: 'text',
value: '<%= @posts %>'
},
{
type: "InstanceVariableReadNode",
location: [[1,0],[1,6]]
type: 'text',
value: '<%= @posts %>'
}
]
},
]
}
<span <% if true %> class="mt-2 <%= post.title %>" <% end %> >
<%= post.description %>
</span>
<% @posts.each do |post| %>
<h1>
<%= post.title %> -- <%= post.description %>
</h1>
<% end %>
3. ide use html tree to provide html autocomplete and language nodes to provide language autocomplete
{{}}
<div data-controller="autocomplete-works">
<%= @posts %>
<%= tag.div "Click", data: { controller: "autocomplete-doesn't-work"} %>
<%= content_tag(:span, "Click", data: { controller: "autocomplete-doesn't-work"} %>
</div>
More updated syntax