Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/syntax_tree/language_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run
store.delete(uri)
in { method: "textDocument/formatting", id:, params: { textDocument: { uri: } } }
contents = store[uri]
write(id: id, result: contents ? [format(store[uri])] : nil)
write(id: id, result: contents ? [format(store[uri], uri.split(".").last)] : nil)
in { method: "textDocument/inlayHint", id:, params: { textDocument: { uri: } } }
contents = store[uri]
write(id: id, result: contents ? inlay_hints(store[uri]) : nil)
Expand Down Expand Up @@ -86,7 +86,7 @@ def capabilities
}
end

def format(source)
def format(source, file_extension)
{
range: {
start: {
Expand All @@ -98,7 +98,7 @@ def format(source)
character: 0
}
},
newText: SyntaxTree.format(source, print_width)
newText: file_extension == "haml" ? SyntaxTree::Haml.format(source, print_width) : SyntaxTree.format(source, print_width)
}
end

Expand All @@ -119,3 +119,4 @@ def write(value)
end
end
end