DAML Studio - Go to definition not working

Go to definition in DAML Studio does not work

OS: Windows Server 2016
SDK: 1.11.1
Steps to reproduce:
From any DAML project, run daml studio
Once the IDE is up an running, try right clicking any variable and click “Go to definition”.
Result: error message is displayed “No definition found for…”

1 Like

Hi @huw I just checked my Linux System, checking several terms, and I also get the message, ‘No definition for blah blah blah’.

However if you place your cursor on for instance, allocatePartyWithHint, you will be a Hover tag, that says Defined in 'Daml.Script'

Seems to be working as per spec to me.

Any reason you are on Daml ver. 1.11.1?

1 Like

Hi @quidagis , if that’s the spec then it’s definitely not a great user experience, as although I can see the location of the definition by hovering, there seems to be no way to navigate to the definition automatically.

Regarding the version, thanks for reminding me, our team needs to upgrade our codebases to the latest SDK.

2 Likes

@huw I think for the Go to Definition feature to work, your code has to compile at least once. After that, Go to Definition should work as advertised, and it does for me on MacOS.

An easy way to check whether compilation has finished it to see whether the “Script View” appears above a Daml Script. If that appears and Go to Definition still doesn’t work, I think you are running into a bug.

Could you test this:

  1. In a fresh project (created from daml new, write the script
t = do
  x <- allocateParty "foo"
  return ()
  1. Wait for the Script View to appear
  2. Right click on allocateParty and hit “Go to Definition”

If that works, we need to see why your own project doesn’t. If it doesn’t work, we have a more fundamental issue, possibly OS-related, that we need to explore.

3 Likes

We test goto definition on CI on Windows and we additionally test it on every release on Windows 10 (and other platforms). I just tried the following steps and it works for me on Windows 10:

  1. Install SDK 1.11.1 via the installer.
  2. Create a new project with daml new foobar
  3. Launch daml studio in that project
  4. Open Main.daml and use goto definition on alice in any of the submit calls.

Note that goto definition does not work for all identifiers at the moment. In particular, I believe goto definition does not work on template and choice field names at this point.

3 Likes

Hi @bernhard, your steps actually work for me. Weirdly it’s working now, maybe it was a compilation issue as you said. I notice if you highlight/select the symbol you want to go to the definition, then right click and hit “go to definition”, then it doesn’t work (as opposed to just simply right clicking without highlighting). Guessing this is more of a VS Code quirk though.

4 Likes