@@ -3649,38 +3649,39 @@ in that particular folder."
36493649
36503650(defun lsp-configure-buffer ()
36513651 "Configure LSP features for current buffer."
3652- (when lsp-auto-configure
3653- (when (and lsp-enable-text-document-color
3654- (lsp-feature? "textDocument/documentColor"))
3655- (add-hook 'lsp-on-change-hook #'lsp--document-color nil t))
3656-
3657- (when (and lsp-enable-imenu
3658- (lsp-feature? "textDocument/documentSymbol"))
3659- (lsp-enable-imenu))
3660-
3661- (when (and lsp-enable-indentation
3662- (lsp-feature? "textDocument/rangeFormatting"))
3663- (setq-local indent-region-function #'lsp-format-region))
3664-
3665- (when (and lsp-enable-symbol-highlighting
3666- (lsp-feature? "textDocument/documentHighlight"))
3667- (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t))
3668-
3669- (when (and lsp-enable-links
3670- (lsp-feature? "textDocument/documentLink"))
3671- (add-hook 'lsp-on-idle-hook #'lsp--document-links nil t))
3672-
3673- (when (and lsp-enable-dap-auto-configure
3674- (functionp 'dap-mode))
3675- (dap-auto-configure-mode 1))
3676-
3677- (when (and lsp-enable-semantic-highlighting
3678- (lsp-feature? "textDocument/semanticTokens"))
3679- (mapc #'lsp--semantic-tokens-initialize-workspace
3680- (lsp--find-workspaces-for "textDocument/semanticTokens"))
3681- (lsp--semantic-tokens-initialize-buffer
3682- (lsp-feature? "textDocument/semanticTokensRangeProvider"))))
3683- (run-hooks 'lsp-configure-hook))
3652+ (let (lsp--cur-workspace)
3653+ (when lsp-auto-configure
3654+ (when (and lsp-enable-text-document-color
3655+ (lsp-feature? "textDocument/documentColor"))
3656+ (add-hook 'lsp-on-change-hook #'lsp--document-color nil t))
3657+
3658+ (when (and lsp-enable-imenu
3659+ (lsp-feature? "textDocument/documentSymbol"))
3660+ (lsp-enable-imenu))
3661+
3662+ (when (and lsp-enable-indentation
3663+ (lsp-feature? "textDocument/rangeFormatting"))
3664+ (setq-local indent-region-function #'lsp-format-region))
3665+
3666+ (when (and lsp-enable-symbol-highlighting
3667+ (lsp-feature? "textDocument/documentHighlight"))
3668+ (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t))
3669+
3670+ (when (and lsp-enable-links
3671+ (lsp-feature? "textDocument/documentLink"))
3672+ (add-hook 'lsp-on-idle-hook #'lsp--document-links nil t))
3673+
3674+ (when (and lsp-enable-dap-auto-configure
3675+ (functionp 'dap-mode))
3676+ (dap-auto-configure-mode 1))
3677+
3678+ (when (and lsp-enable-semantic-highlighting
3679+ (lsp-feature? "textDocument/semanticTokens"))
3680+ (mapc #'lsp--semantic-tokens-initialize-workspace
3681+ (lsp--find-workspaces-for "textDocument/semanticTokens"))
3682+ (lsp--semantic-tokens-initialize-buffer
3683+ (lsp-feature? "textDocument/semanticTokensRangeProvider"))))
3684+ (run-hooks 'lsp-configure-hook)))
36843685
36853686(defun lsp-unconfig-buffer ()
36863687 "Unconfigure LSP features for buffer."
0 commit comments