Open yaroslavyaroslav opened 1 year ago
This is a known issue (see "LSP not initialized on views that are opened multiple times" in #2007) and it is caused by a bug in Sublime Text: https://github.com/sublimehq/sublime_text/issues/2411
We did make a workaround though - https://github.com/sublimelsp/LSP/pull/2174 Is this a different case? Haven't checked yet myself.
From a quick look it seems like the fix would only apply if you manually call the open_file
function from LSP/plugin/core/open.py (like, for example using LSP's "Goto Definition").
Just wonder, why the file: Split View
doesn't affected by that?
Just wonder, why the
file: Split View
doesn't affected by that?
I guess you have to ask this the ST devs, why they employ their bugs only when the duplicate views are created from "Goto Anything", and not via "Split View" 😄
Now seriously, you can test yourself with a little plugin like
import sublime_plugin
class ViewEventListener(sublime_plugin.ViewEventListener):
@classmethod
def applies_to_primary_view_only(cls):
return False
def on_activated_async(self):
print(f"on_activated_async View({self.view.id()}) Buffer({self.view.buffer_id()}) File({self.view.file_name()})")
and will see, that it does print the message in the console after "File: Split View" (or "Split View" from the tab context menu), but not when using the "Goto Anything" panel.
And LSP uses on_activated_async
to check whether to attach a LSP server:
https://github.com/sublimelsp/LSP/blob/673e5138141295813d06133d7bcdfebfb56727fb/plugin/documents.py#L335-L339
Describe the bug
LSP-Sourcekit
doesn't initiates on opening already opened file in a new tab from command pallet with anoption
orcmd
key.To Reproduce
swift package init
./Sources/<PackageName>/
dir. Let's sayAdditionalClass.swift
,AnotherClass.swift
import Foundation
line to all of those files, just in case.AdditionalClass.swift
and convince thatSourceKit
label appears on Sublime Text status bar.AnotherClass.swift
.cmd
oroption
while hittingenter
on a given file, to open it in a split view.There would be new [duplicated] tab opened with this file, and there would be no
SourceKit
label appeared as well as a LSP support.Expected behavior To provide LSP support for a files opened with an duplicated tab through command pallet.
Screenshots
Environment (please complete the following information):
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.