Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28494 Discussions

Intellisense, "go to definition" and "find all references" across projects



New on this forum, we use Fortran 77 and a little bit of C since some years now, on UNIX and Windows platforms, and from the command line until now.

Never too late, we are trying to move to Visual Studio 2015 (2015 is a pre-requisite for other softs) to be more comfortable on Windows (we already use Intel Fortran 2015).

I hoped to get advantage of IntelliSense in Visual Studio. But it seems its scope is limited to one project, and does not apply to an entire solution.

For example, my solution has a "static library" project with 2 files suba.f and subb.f for subroutines suba and subb, and a "console application" project for the main, which is calling suba, which is calling subb.

When I edit suba and select "subb", I get IntelliSense for subb, "goto definition" opens subb.f, and "find all references" finds the call in suba.f and the subroutine in subb.f.

But when I edit main and select "suba", I have no IntelliSense available for suba, "go to definition" does nothing, and "find all references" finds only the "call suba" in main.

Is there a way to use all these tools across all the projects of a solution ?

My settings under Tools > Options > Text Editor > Fortran > Advanced :

  • disable database = false
  • enable database saving/loading = true
  • enable find all references = true
  • enable go to definition = true

Is there something else to set ?

Sorry if this question was already asked ...

0 Kudos
1 Reply
New Contributor III

Hi Thierry, I can confirm this behavior for the case, that there is in a single file a program and subroutine/modules. In the example below t_QUAD4 'goto definition' does nothing. I assume that this is similar to the behavior you mentioned and caused by the same implementation issue. edit: I use PSXE2019 update 5 on VS Pro 2017 (15.9.16).

Unfortunately, the support of IntelliSense like features (for Fortran it's an extension written by Intel) is, let's say, 'uncomplete'. Over the last years I've seen some improvement but no real step forward. If you like to have these features Code::Blocks for Fortran (version from Darius Markauskas) is the best implementation I've seen and it's OpenSource! I've recently seen NetBeans' CLion/PyCharm Fortran plugin to be also an alternative. All of them are cross platform IDEs.

Nevertheless, you might want to open a ticket for this case.

module mytypes
  implicit none  
  ! ------------------
  type t_ELE
    integer :: linear = 0
  end type t_ELE  
  type, extends(t_ELE) :: t_QUAD4
    integer :: nodes = 4
  end type  
  type, extends(t_ELE) :: t_QUAD8
    integer :: nodes = 8
  end type  
  ! -------------------
  type t_element_list
    class(t_ELE), pointer :: element_type => Null()
  end type t_element_list
  end module mytypes
module global_vars
  use mytypes, only : t_QUAD4, t_QUAD8
  implicit none
  type(t_QUAD4), target, public :: QUAD4
  type(t_QUAD8), target, public :: QUAD8    
end module global_vars

! -------------------
program v
  use mytypes    , only : t_QUAD4, t_QUAD8, t_element_list
  use global_vars, only : QUAD4, QUAD8
  implicit none
  ! Variables  
  integer                           :: i
  type(t_element_list), allocatable :: my_element_list(:)  
  my_element_list(1)%element_type => QUAD4 
  my_element_list(2)%element_type => QUAD8 
  write(*,*) my_element_list(1)%element_type%linear
  do i = 1, 2
    select type ( element => my_element_list(i)%element_type )
    type is ( t_QUAD4 )
      write(*,*) element%nodes
    type is ( t_QUAD8 )
      write(*,*) element%nodes
    end select
  end do  
  my_element_list(1)%element_type => Null()
  my_element_list(2)%element_type => Null()
end program v


0 Kudos