Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add .editorconfig support#3849

Open
majiayu000 wants to merge 2 commits intolapce:masterfrom
majiayu000:feat/editorconfig-support
Open

feat: add .editorconfig support#3849
majiayu000 wants to merge 2 commits intolapce:masterfrom
majiayu000:feat/editorconfig-support

Conversation

@majiayu000
Copy link

Summary

  • Add EditorConfig support using the ec4rs crate
  • Automatically apply indent style, indent size, tab width, and line endings from .editorconfig files
  • Include comprehensive tests for the new functionality

Supported Properties

Property Description
indent_style spaces or tabs
indent_size number of columns per indent
tab_width columns per tab character
end_of_line lf or crlf
insert_final_newline parsed but not yet enforced
trim_trailing_whitespace parsed but not yet enforced

Test Plan

  • All existing tests pass
  • New editorconfig tests pass
  • cargo fmt and cargo clippy pass

Closes #95

Implement EditorConfig support using the ec4rs crate. This allows
Lapce to automatically detect and apply editor settings from
.editorconfig files on a per-file basis.

Supported properties:
- indent_style (spaces/tabs)
- indent_size
- tab_width
- end_of_line (lf/crlf)
- insert_final_newline
- trim_trailing_whitespace

Closes lapce#95

Signed-off-by: majiayu000 <[email protected]>
Cargo.toml Outdated
toml_edit = { version = "0.20.2", features = ["serde"] }
url = { version = "2.5.0" }
zstd = { version = "0.11.2" } # follow same version wasmtime-cache in lockfile
ec4rs = { version = "1.2" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it from workspace, it is not needed in other crates

ec4rs is only used in lapce-app, so it should be a direct dependency
rather than a workspace dependency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
let ec_props = self
.content
.with_untracked(|c| c.path().cloned())
.map(|path| editorconfig::get_properties(&path));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand this runs in the GUI part of lapce, which means that you can't access path - it may not be there (in case of running remote proxy). I suspect you need to punch few more holes in RPC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support .editorconfig

3 participants