"Go to Definition" doesn't work with Perl code

When I click “Go to Definition” for a Perl module or function that’s defined outside the current file, nothing happens. This happens for modules/functions that are installed in the system perl libraries and for modules/functions that exist inside the current project (yes, I have added the modules that are part of the project to the include path).

1 Like

Hey @baronmog,

Make sure that Code Intel had completed scanning before you attempted Go To Definition. It is indicated by notices in the Notifications tab (View > Tabs & Sidebars > Notifications) and by a throbber icon in the bottom right corner of the Komodo window.

  • Carey

Ah, I figured there had to be access to error logs somewhere. I get messages like:

evaluating 'XML::LibXML.new' at MessageUtils.pm#1179: could not resolve 'XML::LibXML' (error determining definition) Thu Jun 18 2015 09:40:04 GMT-0700 (PDT)

and

evaluating 'IO.File' at SystemUtils.pm#12: could not resolve 'File' attr on <class 'IO'> (error determining definition) Thu Jun 18 2015 09:48:24 GMT-0700 (PDT)

I don’t see anything indicating the Code Intel has or hasn’t completed scanning the project. I’ve been playing around with Komodo off and on for a couple of weeks, now, but this is the first time I’ve tried to use it’s Go To Definition feature.

Just getting the first obvious (to me) thing out of the way. Could you include some sample code that produces the problem so I can try locally? Go to Def is working for me in Perl files.

Seems a bit early to need to do this if you’ve only been using Komodo 2 weeks but it can’t hurt to reset your code intel database. Still send me sample code though.

  • Carey

Even a file as simple as

#!/usr/bin/perl -w

use strict;
use XML::Simple;
use Data::Dumper;
use File::Basename;
use Sys::Syslog;

results in

Pre-loading code intelligence database Thu Jun 18 2015 21:59:55 GMT-0700 (PDT)

Pre-loading code intelligence database. This process will improve the speed of first time autocomplete and calltips. It typically takes less than a minute.
  Pre-loading standard library data...
  JavaScript standard library...
  Determining necessary updates...
  Adding javascript stdlib
  Node.js standard library...
  Determining necessary updates...
  Adding node.js stdlib
  PHP 5.6 standard library...
  Determining necessary updates...
  Adding php-5.6 stdlib
  Perl 5.20 standard library...
  Determining necessary updates...
  Adding perl-5.16 stdlib
  Python 2.7 standard library...
  Determining necessary updates...
  Adding python-2.7 stdlib
  Python3 3.4 standard library...
  Determining necessary updates...
  Adding python3-3.3 stdlib
  Ruby 2.2 standard library...
  Determining necessary updates...
  Adding ruby-1.9.3 stdlib
  Pre-loading catalogs...
  Determining necessary catalog updates...
  Adding 'rails.cix' API catalog
  Adding 'html5.cix' API catalog
  Adding 'prototype.cix' API catalog
  Adding 'yui.cix' API catalog
  Adding 'dojo.cix' API catalog
  Adding 'python3-pywin32.cix' API catalog
  Adding 'jquery.cix' API catalog
  Adding 'xpcom.cix' API catalog
  Adding 'pywin32.cix' API catalog
  Adding 'ext.cix' API catalog
  Adding 'komodo.cix' API catalog
  Adding 'mochikit.cix' API catalog
  Adding 'xbl.cix' API catalog
  Saving catalog indices...
  Code intelligence database pre-loaded.
--------------------------------------------------------------------------------
Pre-loading code intelligence database Thu Jun 18 2015 21:59:55 GMT-0700 (PDT)
--------------------------------------------------------------------------------
Scanning one directory Thu Jun 18 2015 22:00:33 GMT-0700 (PDT)
--------------------------------------------------------------------------------
evaluating 'Sys.Syslog' at test.pl#7: could not resolve 'Sys' (error determining definition) Thu Jun 18 2015 22:00:33 GMT-0700 (PDT)

It’s a bummer, as code navigation is the main reason I was looking at Komodo for the Perl code I work with. The other being debugger integration.

I am evaluating Komodo 9.3. On a new install, I get this for any package that’s not at the top of a namespace list.

For example, I can ‘go to definition’ for “MyPackageName” works, but fails on “MyPackageName::SubPackage”

I would like to recommend Komodo to colleagues, but I need to get this resolved.

Can you tell me where some more verbose logs might be? Or how to resolve?

thanks

Do you have a code snippet that reproduces the issue you are experiencing? If this is indeed a bug then that would help me produce a fix.

Some more verbose logs are in your Komodo user data directory’s codeintel.log file.

The same for me: unable to jump to a module by selecting “Go to definition”. The test is as above:

Log file says:

Where is the “Sys” module? Is it in a path Komodo is scanning? From your log it does not look like it.

That’s right, I don’t have a Sys module but I do have Sys::Syslog that I’m clicking on.
C:\Perl64\lib\Sys\Syslog.pm
So I was expecting opening the Sys::Syslog.

Allthough I have both Win32 and Win32::API but still can’t access them this way. They are C:\Perl64\lib\Win32.pm and C:\Perl64\lib\Win32\API.pm and by clicking on

use Win32;
use Win32::API;

I’m getting

[2017-02-09 19:02:03,746] [WARNING] codeintel.db: Unable to create symbols.db: possibly exists?
[2017-02-09 19:02:10,194] [ERROR] koCodeIntel:     INFO: eval 'Win32' at test-komodo.pl#4  <Trigger 'perl-defn-defn' at 41 (explicit)>
    INFO: start scope is (<blob 'test-komodo'>, [])
    DEBUG: is 'Win32' from <from Win32 import *>? no
    DEBUG: is 'Win32' from <from Win32::API import *>? no
    INFO: is 'Win32' accessible on (<blob 'test-komodo'>, [])? no
    INFO: is 'Win32' accessible on (<blob '*'>, [])? no
    ERROR: evaluating 'Win32' at test-komodo.pl#4: could not resolve 'Win32'

[2017-02-09 19:07:24,563] [ERROR] koCodeIntel:     INFO: eval 'Win32.API' at test-komodo.pl#5  <Trigger 'perl-defn-defn' at 59 (explicit)>
    INFO: start scope is (<blob 'test-komodo'>, [])
    DEBUG: is 'Win32' from <from Win32 import *>? no
    DEBUG: is 'Win32' from <from Win32::API import *>? no
    INFO: is 'Win32' accessible on (<blob 'test-komodo'>, [])? no
    INFO: is 'Win32' accessible on (<blob '*'>, [])? no
    ERROR: evaluating 'Win32.API' at test-komodo.pl#5: could not resolve 'Win32'

Try adding the C:\Perl64\lib\ directory to Edit > Preferences > Languages > Perl > Additional Perl Import Directories. Komodo’s code intelligence for standard libraries comes from an internal catalog, and not a scan of your system’s Perl library.

Thanks! That helps reaching Win32 but not Win32::API :unamused:

[2017-02-10 11:35:55,239] [INFO] Startup: Welcome to Komodo Edit 10.1.4 build 17456 (platform win32-x86, running on Windows post2012Server version 6.3.9600)
[2017-02-10 11:35:55,240] [INFO] Startup: C:\Program Files (x86)\ActiveState Komodo Edit 10\lib\mozilla\komodo.exe built on Fri Dec 16 19:15:05 2016
...
[2017-02-10 11:36:16,219] [ERROR] koCodeIntel:     INFO: eval 'Win32.API' at test-komodo.pl#5  <Trigger 'perl-defn-defn' at 59 (explicit)>
    INFO: start scope is (<blob 'test-komodo'>, [])
    DEBUG: is 'Win32' from <from Win32 import *>? no
    DEBUG: is 'Win32' from <from Win32::API import *>? no
    INFO: is 'Win32' accessible on (<blob 'test-komodo'>, [])? yes: <class 'Win32'>
    INFO: lookup 'API' on <class 'Win32'> in (<blob 'Win32'>, ['Win32'])
    ERROR: evaluating 'Win32.API' at test-komodo.pl#5: could not resolve 'API' attr on <class 'Win32'>

(No record for eval ‘Win32’ this time)

Okay, I’ve logged a bug for this: https://github.com/Komodo/KomodoEdit/issues/2326

Sorry for the trouble :frowning: