Skip to content

Commit

Permalink
Merge branch 'main' into feat/format-on-paste-2
Browse files Browse the repository at this point in the history
  • Loading branch information
predragnikolic committed Feb 2, 2024
2 parents 1a50fb9 + 8023408 commit d8f60eb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
11 changes: 10 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,41 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.

**Logs**

Check https://lsp.sublimetext.io/troubleshooting/#self-help-instructions on how to provide additional logs.

**Environment (please complete the following information):**

- OS: [e.g. Ubuntu 20.04 or macOS 10.15]
- Sublime Text version: [e.g. 4085]
- LSP version: [e.g. 1.0.12, run `Package Control: List Packages` to find the version]
- Language servers used: [e.g. clangd, gopls, dart, Vetur, intelephense, HIE]

**Additional context**

Add any other context about the problem here. For example, whether you're using a helper
package or your manual server configuration in LSP.sublime-settings. When using
a manual server configuration please include it here if you believe it's applicable.
40 changes: 15 additions & 25 deletions docs/src/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Self-help instructions

To see the LSP server and client communication, run `LSP: Toggle Log Panel` from the Command Palette. Logs are useful to diagnose problems.
Following are the primary places to look at when diagnosing issues:

!!! note
It might be a good idea to restart Sublime Text and reproduce the issue again so that the logs are clean.

If you believe the issue is with this package, please include the output from the Sublime console in your issue report!
1. Run `LSP: Toggle Log Panel` from the *Command Palette* to see communication logs between the server and the client. It allows to see what the server is doing exactly.
2. Open the *Sublime Text* console by going to `View` -> `Show Console` from the main menu. It provides information about installed packages, potential LSP crashes and additional LSP debugging logs when `log_debug` is enabled in `Preferences: LSP Settings`.
3. Focus the relevant file, then run `LSP: Troubleshoot server` from the *Command Palette* and select a server to see troubleshooting information. It can be a very efficient way to diagnose problems quickly when shared.

If the server is crashing on startup, try running `LSP: Troubleshoot server` from the Command Palette and check the "Server output" for potential errors. Consider sharing the output of this command in the report.
!!! note
In case of reporting an issue, consider providing all before-mentioned logs. If you can reproduce the issue, then restarting Sublime Text before capturing the logs can help improve clarity of the logs.

## Updating the PATH used by LSP servers

Expand Down Expand Up @@ -62,31 +62,21 @@ Another solution could be (at least on Linux) to update the server `PATH` using

## Common problems

### 1. LSP doesn't start my language server

When language server is started, its name appears on the left side of the status bar. If you expect your server to start for a particular file but it doesn't then:

* Make sure that the root scope (eg. `source.php`) of the file matches the scope handled by the language server. You can check the root scope of the file by running `Show Scope Name` from the `Tools -> Developer` menu. Refer to the documentation of the language server or its own settings to know the expected scope.
* Make sure that the language server is not disabled globally either in its own settings or in `Preferences: LSP Settings`, or in the project settings (`Project: Edit Project` from the Command Palette).

### 2. LSP cannot find my language server (`No such file or directory: 'xyz'`)

If you are getting an error that the server binary can't be found but it does start when running it from the terminal, then the issue is likely due to Sublime Text's internal environment not picking up the same `PATH` environment variable as you've configured in your shell.
### Error dialog saying `Failed to start...`

See ["Updating the PATH used by LSP servers"](troubleshooting.md#updating-the-path-used-by-lsp-servers) on how to make Sublime Text aware of the location of your langugage server.
If you are getting an error that the server binary can't be found (`No such file or directory...`) but it does start when Sublime Text is started from the terminal, then the issue is likely due to Sublime Text's internal environment not picking up the same `PATH` environment variable as you've configured in your shell. See ["Updating the PATH used by LSP servers"](troubleshooting.md#updating-the-path-used-by-lsp-servers) on how to fix that.

### 3. Popup error `Language server <your_server_language_name> has crashed`
Otherwise refer to the ["Self-help instructions"](troubleshooting.md#self-help-instructions) section to try to understand the issue better.

The reason for this can be the same as in problem number 2. Additionally, the language servers may have dependencies that should also be in your `PATH` in addition to the server binary itself.
### LSP doesn't start my language server

For instance if you have installed the `haskell-language-server` using [ghcup-hs](https://gitlab.haskell.org/haskell/ghcup-hs) you should expose its specific installation folder `~/.ghcup/bin`. If the build process uses `stack` then it should also be in your `PATH`.

If that doesn't solve the issue, try running `LSP: Troubleshoot server` and providing its output when asking for help.
When language server is started, its name appears on the left side of the status bar. If you expect your server to start for a particular file but it doesn't then:

## Known Issues
* Make sure that the root scope (eg. `source.php`) of the file matches the scope handled by the language server. You can check the root scope of the file by running `Show Scope Name` from the `Tools -> Developer` menu. Refer to the documentation of the language server or its own settings to know the expected scope.
* Make sure that the language server is not disabled globally either in its own settings, in `Preferences: LSP Settings` or in the project settings (`Project: Edit Project` from the *Command Palette*).

### Completions not shown after certain keywords

Sublime Text's built-in `Completion Rules.tmPreferences` for some languages suppresses completions after certain keywords.
The solution is to put an edited version of the `Completion Rules.tmPreferences` in the `Packages` folder (you may need to clear the copy in the Cache folder afterwards).
More details on [workaround and a final fix for Lua](https://forum.sublimetext.com/t/bug-lua-autocomplete-not-working-between-if-then/36635)
The solution is to put an edited version of the `Completion Rules.tmPreferences` in the `Packages` folder.
More details on [workaround and a final fix for Lua](https://forum.sublimetext.com/t/bug-lua-autocomplete-not-working-between-if-then/36635).
3 changes: 2 additions & 1 deletion plugin/core/open.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .constants import ST_VERSION
from .logging import exception_log
from .promise import Promise
from .promise import ResolveFunc
Expand Down Expand Up @@ -79,7 +80,7 @@ def _find_open_file(window: sublime.Window, fname: str, group: int = -1) -> Opti
view = window.active_view_in_group(_group)
if view and fname == view.file_name():
return view
return window.find_open_file(fname, group)
return window.find_open_file(fname, group) if ST_VERSION >= 4136 else window.find_open_file(fname)


def open_file(
Expand Down

0 comments on commit d8f60eb

Please sign in to comment.