Sublime Forum

Sublime LSP: Trouble getting basic features like "Go to definition" to work (Intelephense)

#1

I have Sublime LSP and the (premium) Intelephense Server installed, but none of the LSP-specific Goto commands seem to work.

No matter where I put my cursor, or what is highlighted, I can’t Goto the helpers.php file

require_once 'includes/helpers.php';

Log Panel:

LSP-intelephense: Intelephense premium features enabled.
LSP-intelephense: Initialised in 493 ms
LSP-intelephense: Searching file:///Users/chris/Library/Caches/Sublime%20Text/Package%20Storage/LSP-intelephense/16.13.2/language-server/node_modules/intelephense/lib/stub for files to index.
LSP-intelephense: Searching file:///Users/chris/Dropbox/valet/project for files to index.
LSP-intelephense: Indexing started.
LSP-intelephense: Indexing ended. 1 files indexed in 0s.

Diagnostics panel:

Troubleshooting: LSP-intelephense

Version

  • LSP: 1.16.2
  • Sublime Text: 4126

Server Test Run

  • exit code: 0
  • output

Server Configuration

  • command
[
  "/usr/local/bin/node", 
  "/Users/chris/Library/Caches/Sublime Text/Package Storage/LSP-intelephense/16.13.2/language-server/node_modules/intelephense/lib/intelephense.js", 
  "--stdio"
]
  • shell command
/usr/local/bin/node "/Users/chris/Library/Caches/Sublime Text/Package Storage/LSP-intelephense/16.13.2/language-server/node_modules/intelephense/lib/intelephense.js" --stdio
  • selector
embedding.php
  • priority_selector
(source.php)
  • init_options
{
  "clearCache": false, 
  "licenceKey": "{removed for post}"
}
  • settings
{
  "auto_show_diagnostics_panel": false
}
  • env
{
  "PATH": "/usr/local/bin:/usr/local/bin:/usr/local/bin:"
}

Active view

  • File name
/Users/chris/Dropbox/valet/project/wp-content/themes/locks/functions.php
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": true, 
  "syntax": "Packages/PHP/PHP.sublime-syntax"
}
  • base scope
embedding.php

Project / Workspace

  • folders
[
  "/Users/chris/Dropbox/valet/project"
]
  • is project: True
  • project data:
{
  "folders": [
    {
      "path": "."
    }
  ]
}

LSP configuration

{
  "show_diagnostics_panel_on_save": 0
}

System PATH

  • /usr/local/bin
  • /usr/bin
  • /bin
  • /usr/sbin
  • /sbin
0 Likes

#2

That’s simply not how intelephense works I guess. It works for functions/methods/etc.

https://packagecontrol.io/packages/HyperClick is more like what you want.

0 Likes

Autocomplete of CSS in PHP & HTML files
#3

Go to definition and Go to (type) definition are literally key features they highlight on their own site (https://intelephense.com/)

I’ve used that Intelephense functionality on VS Code. I have no reason to believe it wouldn’t work the same on Sublime if setup correctly

0 Likes

#4

are you sure it’s provided by intelephense rather than other (builtin) plugins in vscode?

btw, i assume require_once 'includes/helpers.php'; is all the code. and you want to go to that file with your cursor put on the string.

0 Likes

#5

Just a shot into the blue, but according to linked intelephense website Goto Type Definition is a premium feature which requires a license.

NVM: Just realized LSP-intelephense: Intelephense premium features enabled.

0 Likes

#6

I have the license (and it’s configured). I just removed it from the Diagnostics Panel output for post

0 Likes

#7

ST’s LSP client splits “Goto Definition” into several commands. Thus invoking normal Goto Definition via F12 doesn’t include type definitions.

The related lsp_symbol_type_definition is not bound to a key by default, but can be called via main menu Goto > LSP: Goto Type Definition…. Does that work for you?

0 Likes

#8

I’m not even trying to trigger the command via a shortcut. I’m doing it directly from the command palette and/or menu bar and nothing happens.

Side tangent, I’m not exactly sure what the correct output is supposed to be, but does it make any sense that Intelephense is only indexing 1 file?

LSP-intelephense: Indexing ended. 1 files indexed in 0s.
0 Likes

#9

I can’t reproduce this functionality in VSCode with intelephense premium. Though I am not a good VSCode user so I may do it wrong by just pressing F12 on the string after licensing intelephense.

0 Likes

#10

Following file paths (or links) is probably unrelated with Goto Definition. It may probably be related with Document Link support. Not sure whether LSP supports it or whether it requires further configuration to enable it.

0 Likes

#11

Interesting… clearly some aspect of Sublime and/or Intelephense is aware of my project’s file structure because it’s auto-completing the file path when I declare the require statement.

Bugging the heck out of me that I can’t figure out how to quickly jump to the file considering.

0 Likes