You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
ELP (Erlang Language Platform) is a language server and development tools suite for Erlang, built in Rust. This project provides IDE features, diagnostics, and code analysis for Erlang codebases.
10
+
ELP (Erlang Language Platform) is a language server and development tools suite
11
+
for Erlang, built in Rust. This project provides IDE features, diagnostics, and
12
+
code analysis for Erlang codebases.
13
13
14
14
## Diagnostic Code Management
15
15
16
16
### Adding New Diagnostic Codes
17
17
18
18
When adding new diagnostic codes to `DiagnosticCode` enum:
19
19
20
-
1.**Naming Convention**: Use descriptive PascalCase names that clearly indicate the issue
20
+
1.**Naming Convention**: Use descriptive PascalCase names that clearly indicate
- Include frontmatter with `sidebar_position` matching the code number
@@ -51,16 +52,19 @@ When adding new diagnostic codes to `DiagnosticCode` enum:
51
52
52
53
### Creating DiagnosticDescriptor
53
54
54
-
Every diagnostic must have a corresponding `DiagnosticDescriptor` that defines when and how the diagnostic runs:
55
+
Every diagnostic must have a corresponding `DiagnosticDescriptor` that defines
56
+
when and how the diagnostic runs:
55
57
56
-
1.**Static Descriptor Declaration**: Create a public static descriptor in your diagnostic module
58
+
1.**Static Descriptor Declaration**: Create a public static descriptor in your
59
+
diagnostic module
57
60
- Use `pub(crate) static DESCRIPTOR: DiagnosticDescriptor` pattern
58
61
- Define `DiagnosticConditions` with appropriate flags
59
62
- Provide a checker function that implements the diagnostic logic
60
63
61
64
2.**Diagnostic Conditions**: Configure when the diagnostic should run
62
65
-`experimental`: Mark as true for experimental/unstable diagnostics
63
-
-`include_generated`: Set to false if diagnostic shouldn't run on generated code
66
+
-`include_generated`: Set to false if diagnostic shouldn't run on generated
67
+
code
64
68
-`include_tests`: Set to false if diagnostic shouldn't run on test files
65
69
-`default_disabled`: Set to true if diagnostic requires explicit enabling
66
70
@@ -69,7 +73,8 @@ Every diagnostic must have a corresponding `DiagnosticDescriptor` that defines w
69
73
- Push diagnostics to the `diags` vector using `Diagnostic::new()`
70
74
- Use helper functions to keep the checker clean and focused
71
75
72
-
4.**Registration**: Add the descriptor to `diagnostics_descriptors()` function in `diagnostics.rs`
76
+
4.**Registration**: Add the descriptor to `diagnostics_descriptors()` function
77
+
in `diagnostics.rs`
73
78
- Include your module's `DESCRIPTOR` in the returned vector
74
79
75
80
5.**Module Structure**: Follow the established pattern
@@ -78,12 +83,6 @@ Every diagnostic must have a corresponding `DiagnosticDescriptor` that defines w
78
83
- Include comprehensive tests with `#[cfg(test)]`
79
84
- Use SSR patterns when appropriate for complex matching
80
85
81
-
### Meta-Only vs OSS Code
82
-
83
-
- Use `@fb-only` and `@oss-only` comments to mark platform-specific code
84
-
- Meta-only diagnostics should use `MetaOnlyDiagnosticCode` wrapper
85
-
- Ensure OSS builds work by providing fallbacks for Meta-only features
86
-
87
86
## Rust Code Style
88
87
89
88
### Error Handling
@@ -120,23 +119,33 @@ Every diagnostic must have a corresponding `DiagnosticDescriptor` that defines w
120
119
121
120
### Declarative Test Fixtures
122
121
123
-
ELP uses a declarative test fixture system that allows you to write tests with inline annotations and markers directly in test strings. This system is defined in `/data/sandcastle/boxes/fbsource/fbcode/whatsapp/elp/crates/project_model/src/test_fixture.rs`.
122
+
ELP uses a declarative test fixture system that allows you to write tests with
123
+
inline annotations and markers directly in test strings. This system is defined
124
+
in `crates/project_model/src/test_fixture.rs`.
124
125
125
126
#### Key Features
126
127
127
-
1.**File Organization**: Use `//- /path/to/file.erl` to define multiple files in a single test
128
-
2.**Metadata Markers**: Specify app names, include paths, OTP apps, etc. using metadata after the path
128
+
1.**File Organization**: Use `//- /path/to/file.erl` to define multiple files
129
+
in a single test
130
+
2.**Metadata Markers**: Specify app names, include paths, OTP apps, etc. using
131
+
metadata after the path
129
132
3.**Annotations**: Mark expected diagnostics or ranges using `%% ^^^` syntax
130
-
4.**Cursors and Ranges**: Use `~` markers to indicate positions or ranges in test code
133
+
4.**Cursors and Ranges**: Use `~` markers to indicate positions or ranges in
134
+
test code
131
135
132
136
#### Annotation Syntax
133
137
134
-
Annotations allow you to mark expected diagnostics, types, or other information directly in test code:
135
-
136
-
-**Basic annotation**: `%% ^^^ some text` - Points to the range above matching the caret length
137
-
-**Top-of-file marker**: `%% <<< text` (at file start) - Creates annotation at position 0..0
0 commit comments