Страница:
[DEV] Programming advice and tips & tricks
Страницы
Accessibility Guidelines
Adopting Multi Root Workspace APIs
Automated Issue Triaging
Build Champion
Build and run 32bit Code OSS on Windows
Code Editor Roadmap
Coding Guidelines
Color customization color id changes
Commit Signing
Community Issue Tracking
Contributor License Agreement
Cross Compiling for Debian Based Linux
Dealing with Test Flakiness
December Pre Release
December Test Plan
Design Goals
Development Process
Differences between the repository and Visual Studio Code
Editor decorations & colors
Explain extension causes high cpu load
Extension API guidelines
Extension API process
Feature Areas
Feedback Channels
File Watcher Internals
File Watcher Issues
Git & SCM Issues
Home
How to Contribute
IME Test
Insiders Release Notes
Interactive Window Documentation
Inventory of performance marks
Issue Grooming
Issue Tracking
Issues Triaging
Iteration Plans
Keybinding Issues
Known issues
Lists And Trees
Native Crash Issues
Notebook Smoke Test
Notebook documentation
Notebook layout
November Plan
Performance Issues (old)
Performance Issues
Pointer Device & Touch support
Publish vscode types
Related Projects
Release Process
Releasing vscode.dev
Removing Insiders
Roadmap 2017
Roadmap 2018
Roadmap 2019
Roadmap 2020
Roadmap
Roadmap‐2021‐2022
Running the Endgame
Sanity Check
Search Issues
Selfhosting on Windows WSL
Semantic Highlighting Overview
Setting Descriptions
Smoke Test
Source Code Organization
Submitting Bugs and Suggestions
Terminal Issues
TypeScript Issues
UX
VS Code Speech
Virtual Workspaces
Working Copies
Working with xterm.js
Writing Test Plan Items
Writing Tests
[DEV] Perf Tools for VS Code Development
[DEV] Programming advice and tips & tricks
[WIP] Code Editor Design Doc
[WIP] Design Checklist
[WIP] Design Principles
[dev perf] PerformanceError and unresponsive renderer telemetry
0
[DEV] Programming advice and tips & tricks
Johannes Rieken редактировал(а) эту страницу 2022-10-13 08:51:28 +02:00
This page is a collection of FYI- and TIL-items that spotlights particular useful utilities or programming patterns that aren't obvious or little known. Take them as an offering and not as some must-do.
Disposable utils
- The
Disposable
base class makes it easy for subclasses to_register
values that should be disposed of when the instance is disposed of. DisposableStore
safely manages a collection of disposable values. It is preferred overIDisposable[]
.DisposableMap
manages a map where the values are disposables. It helps you avoid some tricky lifecycle bugs vs implementing aMap<K, IDisposable>
yourself.MutableDisposable
safely manages a disposable value that can change over this. This prevents bugs where you forget to dispose of the old value when overwriting it with a new value.
Data structures
- native
Map
andSet
are sorted by insertion order 💡 this is a little-know but can come handy ResourceMap
andResourceSet
which are normal maps/sets but keyed byURI
LRUCache
is a map with recency and trimming abilitiesTernarySearchTree
is map-like with the ability to lookup sub and super-strings (useful for path containment)SkipList
is a map which is sorted based on a custom comparator functionLinkedList
like arrays but with faster removal/insertion
String/array utils
The modules src/vs/base/common/arrays.ts
and src/vs/base/common/strings.ts
have many very useful utilities when dealing with arrays or strings.
Iterables
The src/vs/base/common/iterator.ts
modules contains utilities for working with iterables. Iterables can be a better alternative than arrays because they enforce readonly-ness by design and hence saving Array.slice
-calls
Lazy, Async, Idle
We have utils to delay certain operations or values
Lazy<T>
a lazy value is computed only when accessed for the first timeIdleValue<T>
is similar toLazy
but uses browser idle times to eagerly compute its value. Implements the "idle until urgent" pattern, see: https://philipwalton.com/articles/idle-until-urgent/runWhenIdle
is our wrapper around browserswindow.requestIdleCallback
-functionscheduleAtNextAnimationFrame
andrunAtThisOrScheduleAtNextAnimationFrame
allows to join this or the next browser animation frame
Project Management
- Roadmap
- Iteration Plans
- Development Process
- Issue Tracking
- Build Champion
- Release Process
- Running the Endgame
- Related Projects
Contributing
- How to Contribute
- Submitting Bugs and Suggestions
- Feedback Channels
- Source Code Organization
- Coding Guidelines
- Testing
- Dealing with Test Flakiness
- Contributor License Agreement
- Extension API Guidelines
- Accessibility Guidelines
Documentation