Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid Ada statement causes a loss of syntax highlighting and code navigation #1139

Open
Joebeazelman opened this issue Mar 29, 2023 · 3 comments

Comments

@Joebeazelman
Copy link

In the code below, the third line uses an odd syntax, which although valid to the compiler and Ada Language Server, results in a partial loss of syntax coloring and code navigation options. When the line is commented out, the syntax coloring returns along with code navigation, except for the line directly under it.

procedure Main is
...
use type USB.Device.Init_Result; -- lose syntax highlighting and other features
Status : USB.Device.Init_Result; -- this line is partially highlighted when the line above is commented out
begin
...
end;
end main;


Interestingly, removing the line produces an error message when compiled:

> operator for type "Init_Result" defined at usb-device.ads:41 is not directly visible

package USB.Device is

type Init_Result is (Ok, Not_Enough_EPs, Not_Enough_EP_Buffer);

end USB.Device;

@reznikmm
Copy link
Member

I'm unable to reproduce this. Could you provide the complete code?

@petacreepers23
Copy link

petacreepers23 commented Apr 14, 2023

I have a similar problem with uses,

having defined and in the path of the gpr:

generic
  V_DATA: STRING;
package Q_OTHER.Q_GENERIC is 
  procedure P_PROCEDURE (V_PARAM : T_TYPE);
...

Then having in file.ads sometihng like:

package Q_PACK_INSTANCE is new Q_OTHER.Q_GENERIC ("SOME_DATA");

and in the body of file.adb

use Q_PACK_INSTANCE ;

The calls to functions defined in Q_OTHER.Q_GENERIC are no longer colored nor is able to navigate to the definition of those.

procedure P_MYPROCEDURE is
begin
    P_PROCEDURE (7); --No color and no navigation to the generic definition
end P_MYPROCEDURE;

@reznikmm
Copy link
Member

reznikmm commented Jun 5, 2023

We still need a complete reproducer. I've tried this one and it works as expected:

package Q_OTHER is
end Q_OTHER;

generic
  V_DATA: STRING;
package Q_OTHER.Q_GENERIC is
   procedure P_PROCEDURE (V_PARAM : Integer);
end Q_OTHER.Q_GENERIC;

with Q_OTHER.Q_GENERIC;
package Q_PACK_INSTANCE is new Q_OTHER.Q_GENERIC ("SOME_DATA");

with Q_PACK_INSTANCE;
procedure Main is
   use Q_PACK_INSTANCE ;
begin
   P_PROCEDURE (7);  -- adsa11213
   Main;
end Main;

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

No branches or pull requests

3 participants