19. How to transition from GPS to GNAT Studio
GPS has been renamed to GNAT Studio. If you were a GPS user, this section describes any adaptation needed your end to handle this transition.
19.1. User Settings
The GPS settings were stored in directory in the .gps
directory in
your home directory (%USERPROFILE
on Windows; $HOME
on Linux).
The GNAT Studio settings are stored in the .gnatstudio
directory
instead.
The first time GNAT Studio is launched, the GPS settings will be automatically copied over to the GNAT Studio directory.
19.2. Environment Variables
GPS was reading the environment varibles GPS_HOME
, GPS_DOC_PATH
and GPS_CUSTOM_PATH
. These have been respectively renamed to
GNATSTUDIO_HOME
, GNATSTUDIO_DOC_PATH
and
GNATSTUDIO_CUSTOM_PATH
.
As a convenience, GNAT Studio falls back to reading the GPS_*
variables if the GNATSTUDIO_*
ones are not defined.
19.3. Change of executable name
The executables gps[.exe]
and gps_cli[.exe]
are now called
gnatstudio[.exe]
and gnatstudio_cli[.exe]
.
If you have any scripts or links referring them, the scripts will need to be adjusted.
If this is convenient to you, you can create a link called gps
pointing to gnatstudio
.
19.4. Custom Scripts and Plugins
19.4.1. GPS.Entity removal
The GPS.Entity
is now obsolete and has been removed. If your custom
plugins were making use of this class, you should now use use the libadalang
Python API (available in the GNAT Studio Python interpreter) instead to get
information about entities present in your source code.
More information about libadalang and its Python API can be found here.
Here is an example that shows how to retrieve the enclosing subprogram of a given location.
import libadalang as lal
def current_subprogram(self):
# Return the LAL node corresponding to the subprogram enclosing the
# current context, or None
curloc = self.location()
buf = GPS.EditorBuffer.get(curloc.file(), open=False)
if not buf:
return False
unit = buf.get_analysis_unit()
node = unit.root.lookup(lal.Sloc(curloc.line(), curloc.column()))
return get_enclosing_subprogram(node)