Closed mcraveiro closed 2 years ago
AFACS it should work in lsp-treemac as well. We should investigate why that does not work with lsp-treemacs.
Thanks for your prompt reply @yyoncho. Now you say that, I do see LSP Symbols (-2)
on the window, same as I see in the treemacs window. Is there something you'd like me to try to check for why this is not kicking in? I will try to look at the code, but my elisp is not the best sadly.
Can you test if https://github.com/emacs-lsp/lsp-treemacs/commit/2e9f6f6dc45f49623f12f29bd4fd7055290c5e0f works fine?
Absolute genius @yyoncho, worked straight away! Many thanks for your help and your prompt response.
Actually, now look a bit more carefully, it seems like lsp-treemacs is a bit more aggressive in the scaling than treemacs itself:
We should be at -2 but lsp-treemacs is at -8 and on every refresh it gets smaller :-) I think something is not quite right. Let me investigate, at least I know where to look now. Thanks
Ok, I will make sure it is called only once.
Actually, sorry, I think there is more to this than I first thought. For good measure, I commented out your code and looked more carefully and now I notice that lsp-treemacs "thinks" its scaling by -2, though the font is no different from no scaling:
You can see on the above screenshot that though both treemacs windows are at -2, they look like they are at different scales. Could this be something to do with the face we use for lsp-treemacs-symbols perhaps?
OK I did some more experimentation, and I think the problem can be described as follows:
treemacs-text-scale
, but in reality its rendering at 0. (text-scale-adjust 0)
(text-scale-adjust -2)
This resulted in -2 correctly rendered at -2:
As you can see this is the same as regular treemacs at -2:
This leads me to conclude that we must be missing some "refresh" on startup before rendering, if you pardon the layperson terminology :-) or better put, we are rendering before we check the value of treemacs-text-scale
. hope this is helpful, and thanks for your time.
Actually, is this too much of a hack? :-D
diff --git a/elpa/lsp-treemacs-20210904.2039/lsp-treemacs.el b/elpa/lsp-treemacs-20210904.2039/lsp-treemacs.el
index e3adef8..0b3c690 100644
--- a/elpa/lsp-treemacs-20210904.2039/lsp-treemacs.el
+++ b/elpa/lsp-treemacs-20210904.2039/lsp-treemacs.el
@@ -929,6 +929,9 @@ will be rendered an empty line between them."
(setq-local treemacs-space-between-root-nodes nil)
(lsp-treemacs--set-mode-line-format search-buffer title)
(lsp-treemacs-generic-refresh)
+ (when treemacs-text-scale
+ (text-scale-adjust 0)
+ (text-scale-increase treemacs-text-scale))
(when expand-depth (lsp-treemacs--expand 'LSP-Generic expand-depth))
(current-buffer))))
Seems to solve my problem :-)
Eh eh no, bad idea, my messages are now spammed with
Use +,-,0 for further adjustment
:-)
OK I really don't know if this is a good fix or not, but it at least solves all my problems :-)
(when treemacs-text-scale
(text-scale-set treemacs-text-scale))
The main improvement over the previous approach is that the pesky Use +,-,0 for further adjustment
now goes away.
I think this is the way to go
I think this is the way to go
Excellent, raised a PR, let me know if there are any issues. Thanks for your time.
Hi lsp-treemacs developers,
thanks a lot for your mode, I find it extremely useful. I use LSP treemacs symbols quite a lot but I have one small problem with it: as my method names are quite large, I need to resize its font to a smaller one. In regular treemacs I've achieved this via
treemacs-text-scale
, _e.g.:Is there an equivalent way to achieve this in lsp-treemacs?
Many thanks for your time.
Marco