-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement a per interpreter language server cache #8815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Put cache inside of the activationService
Codecov Report
@@ Coverage Diff @@
## master #8815 +/- ##
==========================================
- Coverage 58.65% 57.59% -1.06%
==========================================
Files 526 527 +1
Lines 27204 27124 -80
Branches 4059 4123 +64
==========================================
- Hits 15956 15623 -333
- Misses 10369 10617 +248
- Partials 879 884 +5
Continue to review full report at Codecov.
|
src/client/activation/languageServer/languageClientMiddleware.ts
Outdated
Show resolved
Hide resolved
Actually I had another thought on my way home last night. I want to change the disconnect/reconnect pattern to activate/deactivate. Otherwise when we have a notebook switch kernels, we might end up activating a language server for VS code and have two activated at the same time (right now activate is called when the language server is created). I'm going to change activate to basically be reconnect, and have a 'start' on each language server which prepares it to be connected to VS code. Activate will then actually allow that language server to be the VS code language server. #Resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still got a lot to review...
import { noop } from '../common/utils/misc'; | ||
import { ILanguageServer, LanguageServerActivator } from './types'; | ||
|
||
export class RefCountedLanguageServer implements ILanguageServer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Proxy
class instead. Avoids the need to implement each method. #WontFix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I thought there was some way to not have to implement each. Thanks will change.
In reply to: 351403997 [](ancestors = 351403997)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proxy class is messing up tests. Don and I talked and this seemed like the least exposed way to implement the ref counting idea.
In reply to: 351423686 [](ancestors = 351423686,351403997)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DonJayamanne did you have any more changes? |
For #8206
Change how language servers are started and shutdown. Instead of there being only one at a time, allow many based on the interpreter in use.
The crux of this change is in the activationService.ts, It is now also a cache (it kinda had one already) that can be queried to return a language server.
Each language server
The reason for this change is because Notebooks can select a different python to use (called a kernel) than what is currently selected in the python selection.