fix: nvim LSP + theme perf and pwsh Az-runspace review follow-ups#9
Merged
Conversation
azure_pipelines_ls ships filetypes = { 'yaml' } and lsp.lua overrode nothing,
so *.azure-pipelines.* (custom filetype) got no LSP while the ADO-default
azure-pipelines.yml got both yamlls and azure_pipelines_ls. Override the server
to the dedicated azure-pipelines filetype, add the unprefixed default filename
to the detection autocmd, and drop 'Azure Pipelines' from the yamlls schema
select so yamlls no longer competes.
Wire up lua_ls (native vim.lsp.config/enable, gated on lua-language-server being on PATH) with LuaJIT runtime and VIMRUNTIME on the workspace library, so the Lua config that is the most-edited code in the repo gets gd/hover/diagnostics.
detect_theme() called vim.fn.system() synchronously at module load on every startup, blocking on an external process (reg.exe on Windows) even in the minimal profile. Paint the sunrise/sunset heuristic instantly, then query the OS preference via async vim.system and re-apply background + colorscheme only when it disagrees. Guard the Linux gsettings/kreadconfig5 spawns with executable() — vim.system raises on a missing binary where the vim.fn.system it replaced set shell_error. Keeps the Windows registry -> macOS -> GNOME -> KDE ladder and the sunrise/sunset hours.
Start-AzContextRefresh created a new runspace and re-imported Az.Accounts on every 60s tick, though the docstring described a long-lived runspace. Split the cache into a persistent runspace (opened once, recreated only when Broken) and a per-tick invocation; import Az.Accounts once via a one-time async priming invocation on a freshly-created runspace, so per-tick work is just Get-AzContext. A concurrency guard skips a tick when the prior invocation is still running (one pipeline per runspace). Guard the PromptCache init so `. $PROFILE` reuses the live runspace/timer instead of orphaning them. Exit cleanup disposes the pending invocation and the persistent runspace. Adds a Pester test asserting runspace reuse (stable InstanceId across refreshes).
fcc053f to
34f6b04
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the four Neovim + PowerShell follow-up fixes surfaced by the config review (shipped-with-PR-#5 report, tooling-only there). One commit per fix.
Fixes
fix(nvim): scopeazure_pipelines_lsto theazure-pipelinesfiletype — the server shippedfiletypes = { 'yaml' }and nothing overrode it, so*.azure-pipelines.*(custom filetype) got no LSP while the ADO-defaultazure-pipelines.ymlgot both yamlls and azure_pipelines_ls. Override to the dedicated filetype, add the unprefixed default filename to the detection autocmd, and drop'Azure Pipelines'from the yamlls schemaselect.feat(nvim): addlua_ls— nativevim.lsp.config/enable, gated onlua-language-serveron PATH. The repo's most-edited code (this config) had no Lua LSP.perf(nvim): detect OS theme off the startup path —detect_theme()ranvim.fn.system()synchronously at module load (blocking onreg.exeon Windows, even in the minimal profile). Now paints the sunrise/sunset heuristic instantly, then refines via asyncvim.systemonly on disagreement. Linuxgsettings/kreadconfig5spawns are guarded withexecutable()becausevim.systemraises on a missing binary where the oldvim.fn.systemsetshell_error.perf(pwsh): reuse one long-lived Az-context runspace — the refresh created a new runspace and re-imported the Az module every 60s tick. Split into a persistent runspace (opened once, recreated only when broken) + per-tick invocation; module imported once via a one-time async priming invocation; per-tick work is just the context read. Concurrency guard skips a tick while the prior invocation runs; the cache init is guarded so. $PROFILEreuses the live runspace/timer. Bundles review bug B1 (the guarded init); B2 left separable.Verification
nvim/clean.-Recurse -Settings ./PSScriptAnalyzerSettings.psd1: 0 findings.tests/suite green (2/2), including the new runspace-reuse test.reg): no regression; the change removes the synchronous external-process spawn from the load path (a latent win on slower/cold-cache machines).:LspInfoattachment checks for fixes 1/4 are not covered by CI — worth a spot check post-merge.Scope: only these four. The review surfaced more findings, deferred.