unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Question Regarding Line Number Mode For Working With LSP Mode
@ 2022-05-23 18:15 Samuel Banya
  2022-05-23 18:43 ` Samuel Banya
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Banya @ 2022-05-23 18:15 UTC (permalink / raw)
  To: Emanuel Berg

Hey there,

So I have been tweaking my Emacs config for a better LSP setup for JavaScript development.

However, the newest issue I have come across is that line number mode isn't working as intended, even when I enable it manually in a related JavaScript related buffer for a '.js' file.

Here is my related config:
https://github.com/samuelbanya/samsemacs
https://github.com/SamuelBanya/SamsEmacs/blob/main/configuration.org 

Thanks,

Sam


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question Regarding Line Number Mode For Working With LSP Mode
  2022-05-23 18:15 Question Regarding Line Number Mode For Working With LSP Mode Samuel Banya
@ 2022-05-23 18:43 ` Samuel Banya
  2022-05-25  0:18   ` Samuel Banya
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Banya @ 2022-05-23 18:43 UTC (permalink / raw)
  To: Emanuel Berg

I think I got it fixed actually, I was able to enable line numbers in an LSP activated buffer with 'M-x display-line-numbers-mode'. 

Not sure why my config has that off by default but I'm assuming the LSP side of it might have nuked it or something.

Just wanted to share this.

On Mon, May 23, 2022, at 2:15 PM, Samuel Banya wrote:
> Hey there,
> 
> So I have been tweaking my Emacs config for a better LSP setup for JavaScript development.
> 
> However, the newest issue I have come across is that line number mode isn't working as intended, even when I enable it manually in a related JavaScript related buffer for a '.js' file.
> 
> Here is my related config:
> https://github.com/samuelbanya/samsemacs
> https://github.com/SamuelBanya/SamsEmacs/blob/main/configuration.org 
> 
> Thanks,
> 
> Sam
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question Regarding Line Number Mode For Working With LSP Mode
  2022-05-23 18:43 ` Samuel Banya
@ 2022-05-25  0:18   ` Samuel Banya
  2022-05-25  2:31     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Banya @ 2022-05-25  0:18 UTC (permalink / raw)
  To: Emanuel Berg

My last question is this:
How do I get the function from 'M-x display-line-numbers-mode' to trigger when LSP mode is engaged?

On Mon, May 23, 2022, at 2:43 PM, Samuel Banya wrote:
> I think I got it fixed actually, I was able to enable line numbers in an LSP activated buffer with 'M-x display-line-numbers-mode'. 
> 
> Not sure why my config has that off by default but I'm assuming the LSP side of it might have nuked it or something.
> 
> Just wanted to share this.
> 
> On Mon, May 23, 2022, at 2:15 PM, Samuel Banya wrote:
> > Hey there,
> > 
> > So I have been tweaking my Emacs config for a better LSP setup for JavaScript development.
> > 
> > However, the newest issue I have come across is that line number mode isn't working as intended, even when I enable it manually in a related JavaScript related buffer for a '.js' file.
> > 
> > Here is my related config:
> > https://github.com/samuelbanya/samsemacs
> > https://github.com/SamuelBanya/SamsEmacs/blob/main/configuration.org 
> > 
> > Thanks,
> > 
> > Sam
> > 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question Regarding Line Number Mode For Working With LSP Mode
  2022-05-25  0:18   ` Samuel Banya
@ 2022-05-25  2:31     ` Eli Zaretskii
  2022-05-26 15:47       ` Samuel Banya
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-05-25  2:31 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 24 May 2022 20:18:24 -0400
> From: "Samuel Banya" <sbanya@fastmail.com>
> 
> My last question is this:
> How do I get the function from 'M-x display-line-numbers-mode' to trigger when LSP mode is engaged?

Turn it on in the LSP mode hook.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question Regarding Line Number Mode For Working With LSP Mode
  2022-05-25  2:31     ` Eli Zaretskii
@ 2022-05-26 15:47       ` Samuel Banya
  2022-05-26 16:24         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Banya @ 2022-05-26 15:47 UTC (permalink / raw)
  To: Emanuel Berg

Hey Eli,

I tried to do this, but unfortunately using ':hook' for LSP mode within my config doesn't work for some reason, check the ':hook' section below (https://github.com/SamuelBanya/SamsEmacs/blob/main/configuration.org)

#+begin_src emacs-lisp
  (defun ef/lsp-mode-setup ()
    ;; Taken from this 'System Crafters' video:
    ;; https://www.youtube.com/watch?v=E-NAM9U5JYE
    ;; This allows breadcrumb segments to appear in projects
    (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
    (lsp-headerline-breadcrumb-mode))

  (use-package lsp-mode
    :ensure t
    :commands (lsp lsp-deferred)
    ;; Taken from this page:
    ;; https://www.mattduck.com/lsp-python-getting-started.html
    :init
    (setq lsp-keymap-prefix "C-c l")
    (add-hook 'c-mode-hook 'lsp)
    (add-hook 'c++-mode-hook 'lsp)
    (add-hook 'python-mode-hook 'lsp)
    (add-hook 'ruby-mode-hook 'lsp)
    (add-hook 'js2-mode-hook 'lsp)
    (add-hook 'typescript-mode-hook 'lsp)
    (add-hook 'web-mode-hook 'lsp)
    (add-hook 'csharp-mode-hook 'lsp)
    (add-hook 'vue-mode-hook 'lsp)
    (add-hook 'yaml-mode-hook 'lsp)
    :hook
    (display-line-numbers-mode)
    :config
    (lsp-enable-which-key-integration t)
    ;; Set 'lsp-idle-delay' to 0.5 seconds for quick autocompletion
    (setq lsp-idle-delay 0.5)
    ;; Adding this to force lsp to auto-guess the root directory of the project:
    (setq lsp-auto-guess-root t))
#+end_src

On Tue, May 24, 2022, at 10:31 PM, Eli Zaretskii wrote:
> > Date: Tue, 24 May 2022 20:18:24 -0400
> > From: "Samuel Banya" <sbanya@fastmail.com>
> > 
> > My last question is this:
> > How do I get the function from 'M-x display-line-numbers-mode' to trigger when LSP mode is engaged?
> 
> Turn it on in the LSP mode hook.
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question Regarding Line Number Mode For Working With LSP Mode
  2022-05-26 15:47       ` Samuel Banya
@ 2022-05-26 16:24         ` Eli Zaretskii
  2022-05-26 18:05           ` Samuel Banya
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-05-26 16:24 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 26 May 2022 11:47:25 -0400
> From: "Samuel Banya" <sbanya@fastmail.com>
> 
> Hey Eli,
> 
> I tried to do this, but unfortunately using ':hook' for LSP mode within my config doesn't work for some reason, check the ':hook' section below (https://github.com/SamuelBanya/SamsEmacs/blob/main/configuration.org)
> 
> #+begin_src emacs-lisp
>   (defun ef/lsp-mode-setup ()
>     ;; Taken from this 'System Crafters' video:
>     ;; https://www.youtube.com/watch?v=E-NAM9U5JYE
>     ;; This allows breadcrumb segments to appear in projects
>     (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
>     (lsp-headerline-breadcrumb-mode))
> 
>   (use-package lsp-mode
>     :ensure t
>     :commands (lsp lsp-deferred)

Sorry, I'm unfamiliar with use-package.

>     :hook
>     (display-line-numbers-mode)

What is the syntax and the semantics of :hook?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question Regarding Line Number Mode For Working With LSP Mode
  2022-05-26 16:24         ` Eli Zaretskii
@ 2022-05-26 18:05           ` Samuel Banya
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Banya @ 2022-05-26 18:05 UTC (permalink / raw)
  To: Emanuel Berg

I actually got it to work by doing the following revision after the 'use-package' declaration for LSP mode:
(add-hook 'lsp-mode-hook #'display-line-numbers-mode)

Thanks for the help on this.

On Thu, May 26, 2022, at 12:24 PM, Eli Zaretskii wrote:
> > Date: Thu, 26 May 2022 11:47:25 -0400
> > From: "Samuel Banya" <sbanya@fastmail.com>
> > 
> > Hey Eli,
> > 
> > I tried to do this, but unfortunately using ':hook' for LSP mode within my config doesn't work for some reason, check the ':hook' section below (https://github.com/SamuelBanya/SamsEmacs/blob/main/configuration.org)
> > 
> > #+begin_src emacs-lisp
> >   (defun ef/lsp-mode-setup ()
> >     ;; Taken from this 'System Crafters' video:
> >     ;; https://www.youtube.com/watch?v=E-NAM9U5JYE
> >     ;; This allows breadcrumb segments to appear in projects
> >     (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
> >     (lsp-headerline-breadcrumb-mode))
> > 
> >   (use-package lsp-mode
> >     :ensure t
> >     :commands (lsp lsp-deferred)
> 
> Sorry, I'm unfamiliar with use-package.
> 
> >     :hook
> >     (display-line-numbers-mode)
> 
> What is the syntax and the semantics of :hook?
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-26 18:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-23 18:15 Question Regarding Line Number Mode For Working With LSP Mode Samuel Banya
2022-05-23 18:43 ` Samuel Banya
2022-05-25  0:18   ` Samuel Banya
2022-05-25  2:31     ` Eli Zaretskii
2022-05-26 15:47       ` Samuel Banya
2022-05-26 16:24         ` Eli Zaretskii
2022-05-26 18:05           ` Samuel Banya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).