Skip to content

Conversation

ogorodnik
Copy link
Contributor

No description provided.

return Libadalang.Analysis.Ada_Node;
-- Get Libadalang Root node for the given document.

function Get_First_Token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where Get_First_Token is called. Do we really need it?

return Libadalang.Analysis.Ada_Node;
-- Get Libadalang Node for given position in the document.

function Get_Root_Node
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest to not expose the root node, but move folding population code into the Ada_Documents instead? It would make Ada_Handler a bit shorter.

end if;

if Value.capabilities.textDocument.foldingRange.Is_Set then
if Value.capabilities.textDocument.foldingRange.Value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use and then instead of then if?

(Is_Set => True, Value => LSP.Messages.Region);

Sloc := Sloc_Range (Data (Node.Token_Start));
foldingRange.startLine := LSP_Number (Sloc.Start_Line) - 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reuse LSP.Lal_Utils.Get_Node_Location function? This will simplifies job when we will fix Position.column calculation at some point. The offsets are based on a UTF-16 string representation, so counting it as character index is incorrect.

data => <>));
return Response;
if Doc /= null then
-- Doc.Get_Root_Node (C.all).Unit.Print;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this comment.

procedure Parse (Node : Libadalang.Analysis.Ada_Node);
-- Check the Node and all its children recursively

procedure Parse (Token : Libadalang.Common.Token_Reference);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/represen t/represent/ or may be contain is better.

Store_With;
end case;

declare
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A proposal: use standard Libadalang traverse procedure to iterate tree nodes, then do a separate pass over trivias-comments instead of inventing a custom traverse code.

Feel free to ignore.

@AnthonyLeonardoGracio
Copy link
Collaborator

Don't forget to update the README once we have the request fully implemented

@Entomy
Copy link
Contributor

Entomy commented Feb 29, 2020

This should probably remove the foldingStartMarker and foldingStopMarker from ada.tmLanguage.json as well, so they don't conflict with each other.

@ogorodnik ogorodnik closed this Mar 2, 2020
@ogorodnik ogorodnik deleted the SA22-032 branch March 2, 2020 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants