Skip to content

Commit 3b9da60

Browse files
committed
cursor rules and settings
1 parent 39d962f commit 3b9da60

File tree

2 files changed

+229
-11
lines changed

2 files changed

+229
-11
lines changed

.cursor/rules/standards.mdc

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# VS Code Extension Development Rules
2+
3+
## Project Overview
4+
5+
This is a VS Code extension for better CSS stacking contexts visualization and analysis. The extension helps developers understand and debug CSS stacking contexts by providing visual indicators, diagnostics, and navigation tools.
6+
7+
## Code Style & Standards
8+
9+
### TypeScript
10+
11+
- Use strict TypeScript configuration
12+
- Prefer explicit types over `any`
13+
- Use interfaces for object shapes
14+
- Use enums for constants
15+
- Use readonly properties where appropriate
16+
- Use optional chaining and nullish coalescing
17+
- Prefer const assertions for literal types
18+
19+
### Naming Conventions
20+
21+
- Use PascalCase for classes, interfaces, and types
22+
- Use camelCase for variables, functions, and methods
23+
- Use UPPER_SNAKE_CASE for constants
24+
- Use descriptive names that explain intent
25+
- Prefix private methods with underscore if needed
26+
27+
### File Organization
28+
29+
- Keep files focused on single responsibility
30+
- Use barrel exports (index.ts) for clean imports
31+
- Group related functionality in directories
32+
- Separate concerns: providers, commands, helpers, types
33+
34+
### VS Code Extension Patterns
35+
36+
- Use the VS Code extension API properly
37+
- Implement proper disposal patterns for resources
38+
- Use event-driven architecture where appropriate
39+
- Follow VS Code's command and provider patterns
40+
- Use proper error handling and logging
41+
42+
## Architecture Guidelines
43+
44+
### Providers
45+
46+
- Each provider should have a single responsibility
47+
- Implement proper dispose methods
48+
- Use caching where appropriate for performance
49+
- Handle VS Code lifecycle events properly
50+
51+
### Commands
52+
53+
- Keep commands focused and simple
54+
- Use proper argument validation
55+
- Provide meaningful error messages
56+
- Follow VS Code command patterns
57+
58+
### Helpers
59+
60+
- Create pure functions where possible
61+
- Use proper error handling
62+
- Add JSDoc comments for complex functions
63+
- Keep helper functions small and focused
64+
65+
## Testing
66+
67+
- Write unit tests for all public functions
68+
- Test edge cases and error conditions
69+
- Use descriptive test names
70+
- Mock VS Code API calls in tests
71+
- Test both success and failure scenarios
72+
73+
## Performance
74+
75+
- Cache expensive operations
76+
- Use debouncing for user interactions
77+
- Minimize DOM queries and updates
78+
- Use efficient data structures
79+
- Profile performance-critical code
80+
81+
## Error Handling
82+
83+
- Use try-catch blocks appropriately
84+
- Log errors with context
85+
- Provide user-friendly error messages
86+
- Handle VS Code API errors gracefully
87+
- Use proper error types
88+
89+
## Documentation
90+
91+
- Add JSDoc comments for public APIs
92+
- Document complex algorithms
93+
- Keep README up to date
94+
- Document configuration options
95+
- Add inline comments for complex logic
96+
97+
## CSS/SCSS Specific
98+
99+
- Follow BEM naming conventions
100+
- Use CSS custom properties for theming
101+
- Ensure proper stacking context handling
102+
- Test in both light and dark themes
103+
- Use semantic class names
104+
105+
## Git & Version Control
106+
107+
- Write descriptive commit messages
108+
- Use conventional commits format
109+
- Keep commits focused and atomic
110+
- Update CHANGELOG.md for user-facing changes
111+
- Tag releases appropriately
112+
113+
## Extension Development Best Practices
114+
115+
- Follow VS Code extension guidelines
116+
- Use proper activation events
117+
- Implement proper contribution points
118+
- Handle workspace and file changes
119+
- Provide meaningful user feedback
120+
- Support both light and dark themes
121+
- Test across different VS Code versions
122+
123+
## Code Quality
124+
125+
- Use ESLint for code quality
126+
- Use Prettier for formatting
127+
- Fix all linting errors
128+
- Use meaningful variable names
129+
- Avoid code duplication
130+
- Keep functions small and focused
131+
- Use early returns to reduce nesting
132+
133+
## Security
134+
135+
- Validate all user inputs
136+
- Sanitize data before display
137+
- Use proper file path handling
138+
- Avoid eval() and similar functions
139+
- Follow VS Code security guidelines
140+
141+
## Accessibility
142+
143+
- Provide keyboard navigation
144+
- Use semantic HTML where applicable
145+
- Ensure proper color contrast
146+
- Add ARIA labels where needed
147+
- Test with screen readers
148+
149+
## Internationalization
150+
151+
- Use VS Code's localization system
152+
- Externalize user-facing strings
153+
- Support multiple languages
154+
- Use proper date/time formatting
155+
- Consider cultural differences
156+
157+
## Performance Monitoring
158+
159+
- Monitor extension activation time
160+
- Track memory usage
161+
- Profile expensive operations
162+
- Use VS Code's built-in profiling tools
163+
- Optimize based on real usage data
164+
165+
- Use VS Code's built-in profiling tools
166+
- Optimize based on real usage data

.vscode/settings.json

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,65 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
3-
"files.exclude": {
4-
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5-
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6-
},
7-
"search.exclude": {
8-
"out": true, // set this to false to include "out" folder in search results
9-
"dist": true // set this to false to include "dist" folder in search results
10-
},
11-
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12-
"typescript.tsc.autoDetect": "off"
13-
}
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off",
13+
14+
// Cursor and editing settings
15+
"editor.cursorBlinking": "smooth",
16+
"editor.cursorSmoothCaretAnimation": "on",
17+
"editor.cursorWidth": 2,
18+
"editor.multiCursorModifier": "alt",
19+
"editor.wordWrap": "on",
20+
"editor.wordWrapColumn": 120,
21+
"editor.rulers": [120],
22+
"editor.bracketPairColorization.enabled": true,
23+
"editor.guides.bracketPairs": true,
24+
"editor.guides.bracketPairsHorizontal": true,
25+
"editor.guides.indentation": true,
26+
"editor.linkedEditing": true,
27+
"editor.suggestSelection": "first",
28+
"editor.tabCompletion": "on",
29+
"editor.acceptSuggestionOnCommitCharacter": false,
30+
"editor.acceptSuggestionOnEnter": "on",
31+
"editor.quickSuggestions": {
32+
"other": true,
33+
"comments": false,
34+
"strings": true
35+
},
36+
"editor.parameterHints.enabled": true,
37+
"editor.hover.enabled": true,
38+
"editor.hover.delay": 300,
39+
"editor.codeActionsOnSave": {
40+
"source.fixAll.eslint": "explicit",
41+
"source.organizeImports": "explicit"
42+
},
43+
44+
// File settings
45+
"files.trimTrailingWhitespace": true,
46+
"files.insertFinalNewline": true,
47+
"files.trimFinalNewlines": true,
48+
"files.eol": "\n",
49+
"files.autoSave": "onFocusChange",
50+
51+
// TypeScript settings
52+
"typescript.preferences.includePackageJsonAutoImports": "on",
53+
"typescript.suggest.autoImports": true,
54+
"typescript.updateImportsOnFileMove.enabled": "always",
55+
"typescript.preferences.importModuleSpecifier": "relative",
56+
57+
// Explorer settings
58+
"explorer.confirmDelete": false,
59+
"explorer.confirmDragAndDrop": false,
60+
61+
// Terminal settings
62+
"terminal.integrated.defaultProfile.windows": "Git Bash",
63+
"terminal.integrated.cursorBlinking": true,
64+
"terminal.integrated.cursorStyle": "line"
65+
}

0 commit comments

Comments
 (0)