본문 바로가기
개발/에디터 (Helix)

Helix LSP 설정 가이드.

by 레조 2024. 5. 22.

Helix Command Line Text Editor

 

Helix LSP 설정 가이드.

 

LSP를 사용하면 코드 편집기에 필수적인 중요한 자동화 기능들을 쉽게 접할 수 있습니다.

예를 들어, 코드 완성, 문법 검사, 정의로 이동 도구 사용이 가능합니다.

 

LSP 설정하기

1. Normal 모드 (ESC키)에서 config.toml 설정 파일을 연다.

:config_open

 

config.toml

theme = "dark_plus"

[editor]
line-number = "absolute" # absolute or relative
mouse = false
auto-format = false

[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"

[editor.file-picker]
hidden = false

[keys.normal]
"ins" = "insert_mode"
"del" = "delete_selection"
"A-j" = ["extend_to_line_bounds", "delete_selection", "paste_after"]
"A-k" = ["extend_to_line_bounds", "delete_selection", "move_line_up", "paste_before"]

[keys.normal.backspace]
e = [":w", ":sh poetry run python main.py"]
r = [":w", ":sh cargo run"]
s = [":w", ":config-reload"]
c = [":config-open"]
y = [":clipboard-yank"]
p = [":clipboard-paste-before"]

 

2. LSP (Language Server Protocol) 사용을 위한 rust-analyzer 설치

rustup component add rust-analyzer

 

3. languages.toml 파일을 cargo.toml 파일과 같은 위치에 복사한다.

(cargo.toml 위치 : ~/scoop/persist/helix)

 

languages.toml

https://github.com/helix-editor/helix/blob/master/languages.toml

 

 

이제 에디터를 다시 시작하면 LSP 사용됩니다. Goto Definition!