Skip to content

Commit 7fc84f5

Browse files
authored
Merge pull request #3652 from 1c-syntax/develop
0.25.0
2 parents ab4d288 + 321bdf9 commit 7fc84f5

File tree

530 files changed

+19608
-3292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+19608
-3292
lines changed

.coderabbit.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
reviews:
2+
path_filters:
3+
- "!src/test/resources/**"

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Java",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",
6+
"image": "mcr.microsoft.com/devcontainers/java:1-25-bookworm",
77

88
"features": {
99
"ghcr.io/devcontainers/features/java:1": {

.github/copilot-instructions.md

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# Copilot Instructions for BSL Language Server
2+
3+
## Project Overview
4+
5+
BSL Language Server is an implementation of the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) for 1C (BSL) - the 1C:Enterprise 8 language and [OneScript](http://oscript.io).
6+
7+
This is a Java-based language server that provides code analysis, diagnostics, code actions, and other language features for 1C development.
8+
9+
**Key Resources:**
10+
- Project site: https://1c-syntax.github.io/bsl-language-server
11+
- Documentation: [docs/index.md](../docs/index.md) (Russian), [docs/en/index.md](../docs/en/index.md) (English)
12+
- Contributor's Guide: [docs/en/contributing/index.md](../docs/en/contributing/index.md)
13+
14+
## Technology Stack
15+
16+
- **Language:** Java 17
17+
- **Build System:** Gradle with Kotlin DSL
18+
- **Frameworks:** Spring Boot
19+
- **Key Technologies:**
20+
- ANTLR for parsing
21+
- Lombok for reducing boilerplate
22+
- JUnit for testing
23+
- Language Server Protocol implementation
24+
25+
## Environment Setup
26+
27+
### Prerequisites
28+
- Java Development Kit 17
29+
- Gradle (wrapper included in the repository)
30+
31+
### Building the Project
32+
```bash
33+
./gradlew build
34+
```
35+
36+
### Running Tests
37+
```bash
38+
./gradlew test
39+
```
40+
41+
### Running Quality Checks
42+
```bash
43+
./gradlew check
44+
```
45+
46+
## Development Workflow
47+
48+
### For Diagnostics Development
49+
50+
When developing new diagnostics or modifying existing ones:
51+
52+
1. **Study the Documentation:**
53+
- Review [Diagnostic Development Workflow](../docs/en/contributing/DiagnosticDevWorkFlow.md)
54+
- Check [Diagnostic Structure](../docs/en/contributing/DiagnosticStructure.md)
55+
- Understand [Diagnostic Types and Severity](../docs/en/contributing/DiagnosticTypeAndSeverity.md)
56+
57+
2. **Implementation Guidelines:**
58+
- Each diagnostic should have:
59+
- Java implementation class
60+
- Resource bundle for localized messages
61+
- Unit tests
62+
- Documentation
63+
- Follow naming conventions from existing diagnostics
64+
- Use appropriate diagnostic tags and severity levels
65+
66+
3. **Testing:**
67+
- Write comprehensive unit tests for each diagnostic
68+
- Include test cases for edge cases
69+
- Follow existing test patterns in the codebase
70+
71+
4. **Documentation:**
72+
- Update diagnostic documentation in both Russian and English
73+
- Include examples of problematic code and fixes
74+
- Document configuration parameters if applicable
75+
76+
### For Core Functionality Development
77+
78+
1. **Code Structure:**
79+
- Main source: `src/main/java`
80+
- Tests: `src/test/java`
81+
- Resources: `src/main/resources`, `src/test/resources`
82+
83+
2. **Testing:**
84+
- Always run tests before submitting changes: `./gradlew test`
85+
- Maintain or improve test coverage
86+
- Use appropriate test frameworks (JUnit, AssertJ, Mockito)
87+
88+
## Code Style and Conventions
89+
90+
### General Guidelines
91+
- **Follow the [Style Guide](../docs/en/contributing/StyleGuide.md)**
92+
- Use Lombok annotations to reduce boilerplate code
93+
- Enable annotation processing in your IDE
94+
- Use EditorConfig for consistent formatting (`.editorconfig` is provided)
95+
96+
### Import Management
97+
- Optimize imports before committing
98+
- Use automatic import optimization provided by the IDE
99+
- DO NOT optimize imports across the entire project unless specifically working on that task
100+
101+
### Naming Conventions
102+
- Follow Java naming conventions
103+
- Use meaningful, descriptive names
104+
- Keep class and method names concise but clear
105+
106+
### Documentation
107+
- Write JavaDoc for public APIs
108+
- Include comments for complex logic
109+
- Keep documentation up to date with code changes
110+
111+
## Important Files and Directories
112+
113+
- `build.gradle.kts` - Main build configuration
114+
- `src/main/java/com/github/_1c_syntax/bsl/languageserver/` - Main source code
115+
- `diagnostics/` - Diagnostic implementations
116+
- `context/` - Language context and parsing
117+
- `providers/` - LSP providers
118+
- `src/main/resources/` - Resources, including diagnostic descriptions
119+
- `src/test/java/` - Unit tests
120+
- `docs/` - Documentation in Russian
121+
- `docs/en/` - Documentation in English
122+
123+
## Continuous Integration
124+
125+
The project uses GitHub Actions for CI/CD:
126+
- **Quality Assurance:** `qa.yml` - Runs tests and code quality checks
127+
- **Pre-QA:** `pre-qa.yml` - Quick validation
128+
- **CodeQL:** `codeql-analysis.yml` - Security analysis
129+
- **Releases:** `release.yml` - Automated release process
130+
131+
Always ensure your changes pass all CI checks before finalizing.
132+
133+
## Bilingual Requirements
134+
135+
This project maintains documentation in **both Russian and English**. When making changes:
136+
- Update documentation in both languages
137+
- Maintain consistency between translations
138+
- Resource bundles should have both Russian and English versions
139+
140+
## Testing Strategy
141+
142+
### Unit Tests
143+
- Test each diagnostic with multiple scenarios
144+
- Include positive and negative test cases
145+
- Test configuration parameters if applicable
146+
- Use the existing test infrastructure and patterns
147+
148+
### Integration Tests
149+
- Some diagnostics may require integration testing
150+
- Follow patterns from existing integration tests
151+
152+
### Running Specific Tests
153+
```bash
154+
# Run all tests
155+
./gradlew test
156+
157+
# Run tests for a specific class
158+
./gradlew test --tests "ClassName"
159+
160+
# Run tests matching a pattern
161+
./gradlew test --tests "*DiagnosticTest"
162+
```
163+
164+
## Common Tasks
165+
166+
### Adding a New Diagnostic
167+
1. Create diagnostic class in `src/main/java/.../diagnostics/`
168+
2. Create resource bundles in `src/main/resources/.../diagnostics/`
169+
3. Add unit tests in `src/test/java/.../diagnostics/`
170+
4. Add documentation in `docs/diagnostics/` and `docs/en/diagnostics/`
171+
5. Register the diagnostic if needed
172+
6. Run tests and ensure they pass
173+
174+
### Fixing a Bug
175+
1. Write a failing test that reproduces the bug
176+
2. Fix the bug with minimal changes
177+
3. Ensure all tests pass
178+
4. Update documentation if the behavior changes
179+
180+
### Updating Dependencies
181+
- Dependencies are managed in `build.gradle.kts`
182+
- Always test thoroughly after dependency updates
183+
- Check for breaking changes in release notes
184+
185+
## Security Considerations
186+
187+
- Never commit sensitive data or credentials
188+
- Be cautious with external dependencies
189+
- Review security alerts from CodeQL and Dependabot
190+
- Follow secure coding practices
191+
192+
## Additional Resources
193+
194+
- [FAQ](../docs/en/faq.md)
195+
- [System Requirements](../docs/en/systemRequirements.md)
196+
- [Events API](../docs/en/contributing/EventsApi.md)
197+
- [Performance Measurement](../docs/en/contributing/Measures.md)
198+
- [Diagnostic Tags](../docs/en/contributing/DiagnosticTag.md)
199+
- [Adding Parameters to Diagnostics](../docs/en/contributing/DiagnostcAddSettings.md)
200+
- [Adding QuickFixes](../docs/en/contributing/DiagnosticQuickFix.md)
201+
202+
## Notes for AI Coding Agents
203+
204+
- This is a mature, production-quality project with high standards
205+
- Maintain backward compatibility unless explicitly breaking changes are planned
206+
- Follow the existing patterns and conventions strictly
207+
- When in doubt, refer to similar existing code for guidance
208+
- Always run the full test suite before considering a task complete
209+
- Respect the bilingual nature of documentation and resources

.github/scripts/build-jpackage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def build_image(base_dir, image_prefix, executable_file):
2323
cmd_args.append('--type')
2424
cmd_args.append('app-image')
2525
cmd_args.append('--java-options')
26-
cmd_args.append('-Xmx3g')
26+
cmd_args.append('-Xmx4g')
2727

2828
cmd = ' '.join(cmd_args)
2929
os.system(cmd)

.github/scripts/check-pr-exists.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Check if a pull request exists for the current branch
3+
# Returns: Outputs "true" if PR exists for non-protected branches, "false" otherwise
4+
5+
set -e
6+
7+
EVENT_NAME="$1"
8+
REF_NAME="$2"
9+
REPOSITORY="$3"
10+
11+
if [ "$EVENT_NAME" == "push" ]; then
12+
# Always run workflows for master and develop branches
13+
if [ "$REF_NAME" == "master" ] || [ "$REF_NAME" == "develop" ]; then
14+
echo "false"
15+
else
16+
# Check if PR exists for this branch
17+
prs=$(gh pr list --repo "$REPOSITORY" --head "$REF_NAME" --state open --json number --jq 'length')
18+
if [ "$prs" -gt 0 ]; then
19+
echo "true"
20+
else
21+
echo "false"
22+
fi
23+
fi
24+
else
25+
echo "false"
26+
fi
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import os
2+
import sys
3+
import io
4+
5+
# Ensure UTF-8 encoding for stdout on Windows to handle Unicode characters
6+
if sys.platform == 'win32':
7+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
8+
9+
10+
def verify_archive_size(archive_path, min_size_mb=1):
11+
"""
12+
Verify that the archive file exists and is larger than the minimum size.
13+
14+
Args:
15+
archive_path: Path to the archive file
16+
min_size_mb: Minimum size in megabytes (default: 1)
17+
18+
Returns:
19+
0 if validation passes, 1 otherwise
20+
"""
21+
min_size_bytes = min_size_mb * 1024 * 1024 # Convert MB to bytes
22+
23+
# Check if file exists
24+
if not os.path.isfile(archive_path):
25+
print(f"Error: Archive file '{archive_path}' not found")
26+
return 1
27+
28+
# Get file size
29+
file_size = os.path.getsize(archive_path)
30+
31+
# Print information
32+
print(f"Archive file: {archive_path}")
33+
print(f"Archive size: {file_size:,} bytes ({file_size / (1024 * 1024):.2f} MB)")
34+
print(f"Minimum required size: {min_size_bytes:,} bytes ({min_size_mb} MB)")
35+
36+
# Validate size
37+
if file_size < min_size_bytes:
38+
print(f"Error: Archive size is less than {min_size_mb} MB")
39+
return 1
40+
41+
print("✓ Archive size validation passed")
42+
return 0
43+
44+
45+
if __name__ == "__main__":
46+
if len(sys.argv) < 2:
47+
print("Usage: python verify-archive-size.py <archive_file> [min_size_mb]")
48+
print(" archive_file: Path to the archive file to verify")
49+
print(" min_size_mb: Minimum size in megabytes (integer, default: 1)")
50+
sys.exit(1)
51+
52+
archive_file = sys.argv[1]
53+
54+
# Parse min_size with error handling
55+
min_size = 1 # default
56+
if len(sys.argv) > 2:
57+
try:
58+
min_size = int(sys.argv[2])
59+
if min_size <= 0:
60+
print("Error: min_size_mb must be a positive integer")
61+
sys.exit(1)
62+
except ValueError:
63+
print(f"Error: Invalid min_size_mb '{sys.argv[2]}'. Must be an integer.")
64+
sys.exit(1)
65+
66+
exit_code = verify_archive_size(archive_file, min_size)
67+
sys.exit(exit_code)

.github/workflows/benchmark.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,41 @@ on:
2222
- 'lombok.config'
2323

2424
jobs:
25+
check-pr-exists:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
has_pr: ${{ steps.check.outputs.has_pr }}
29+
steps:
30+
- uses: actions/checkout@v6
31+
- name: Check if PR exists for this branch
32+
id: check
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
result=$(.github/scripts/check-pr-exists.sh "${{ github.event_name }}" "${{ github.ref_name }}" "${{ github.repository }}")
37+
echo "has_pr=$result" >> $GITHUB_OUTPUT
38+
2539
Benchmark:
40+
needs: check-pr-exists
41+
if: needs.check-pr-exists.outputs.has_pr != 'true'
2642
runs-on: self-hosted
2743
steps:
2844
- name: Checkout project
29-
uses: actions/checkout@v3
30-
45+
uses: actions/checkout@v6
46+
with:
47+
fetch-depth: 0
3148
- name: Setup JDK
32-
uses: actions/setup-java@v4
49+
uses: actions/setup-java@v5
3350
with:
34-
java-version: 17
35-
distribution: 'temurin'
51+
java-version: 25
52+
distribution: 'corretto'
3653
cache: gradle
3754

3855
- name: Build with Gradle
3956
run: ./gradlew bootJar
4057

4158
- name: Set up Python
42-
uses: actions/setup-python@v5
59+
uses: actions/setup-python@v6
4360
with:
4461
python-version: "3.7"
4562

@@ -53,7 +70,7 @@ jobs:
5370
run: pytest .github/scripts/benchmark.py --benchmark-min-rounds=3 --benchmark-timer=time.time --benchmark-json=output.json --benchmark-verbose
5471

5572
- name: Archive results in SARIF
56-
uses: actions/upload-artifact@v4
73+
uses: actions/upload-artifact@v6
5774
with:
5875
name: "SARIF report"
5976
path: bsl-ls.sarif

0 commit comments

Comments
 (0)