Repository: alefragnani/vscode-numbered-bookmarks Branch: master Commit: 7808cac31ca5 Files: 61 Total size: 214.9 KB Directory structure: gitextract_hgo16td6/ ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── config.yml │ │ └── feature_request.md │ ├── copilot-instructions.md │ ├── instructions/ │ │ └── localization-pr-review.instructions.md │ ├── pull_request_template.md │ ├── skills/ │ │ ├── vscode-ext-commands/ │ │ │ └── SKILL.md │ │ └── vscode-ext-localization/ │ │ └── SKILL.md │ └── workflows/ │ └── main.yml ├── .gitignore ├── .gitmodules ├── .vscode/ │ ├── bookmarks.json │ ├── extensions.json │ ├── launch.json │ ├── numbered-bookmarks.json │ ├── settings.json │ └── tasks.json ├── .vscodeignore ├── AGENTS.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── l10n/ │ ├── bundle.l10n.json │ └── bundle.l10n.pt-br.json ├── package.json ├── package.nls.json ├── package.nls.pt-br.json ├── src/ │ ├── core/ │ │ ├── bookmark.ts │ │ ├── constants.ts │ │ ├── container.ts │ │ ├── controller.ts │ │ ├── file.ts │ │ └── operations.ts │ ├── decoration/ │ │ └── decoration.ts │ ├── extension.ts │ ├── quickpick/ │ │ └── controllerPicker.ts │ ├── sticky/ │ │ ├── sticky.ts │ │ └── stickyLegacy.ts │ ├── storage/ │ │ └── workspaceState.ts │ ├── test/ │ │ ├── runTest.ts │ │ └── suite/ │ │ ├── extension.test.ts │ │ └── index.ts │ ├── utils/ │ │ ├── fs.ts │ │ ├── reveal.ts │ │ └── revealLocation.ts │ └── whats-new/ │ ├── commands.ts │ └── contentProvider.ts ├── tsconfig.json ├── walkthrough/ │ ├── customizingAppearance.md │ ├── customizingAppearance.nls.pt-br.md │ ├── inspiredInDelphiButOpenToOthers.md │ ├── inspiredInDelphiButOpenToOthers.nls.pt-br.md │ ├── navigateToNumberedBookmarks.md │ ├── navigateToNumberedBookmarks.nls.pt-br.md │ ├── toggle.md │ ├── toggle.nls.pt-br.md │ ├── workingWithRemotes.md │ └── workingWithRemotes.nls.pt-br.md └── webpack.config.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ github: alefragnani patreon: alefragnani custom: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EP57F3B6FXKTU&lc=US&item_name=Alessandro%20Fragnani&item_number=vscode%20extensions¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help Numbered Bookmarks improve title: "[BUG] - " labels: bug assignees: '' --- **Environment/version** - Extension version: - VSCode version: - OS version: **Steps to reproduce** 1. 2. ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false contact_links: - name: Question url: https://github.com/alefragnani/vscode-numbered-bookmarks/discussions?discussions_q=category%3AQ%26A about: Ask a question about Numbered Bookmarks ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for Numbered Bookmarks title: "[FEATURE] - " labels: enhancement assignees: '' --- ================================================ FILE: .github/copilot-instructions.md ================================================ # Copilot Instructions for Numbered Bookmarks Always reference these instructions first and fall back to additional search or terminal commands only when project files do not provide enough context. ## Project Overview Numbered Bookmarks is a Visual Studio Code extension that helps users navigate code by marking and jumping to important positions with numbered bookmarks (0-9), inspired by Delphi IDE. ## Technology Stack - Language: TypeScript - Runtime: VS Code Extension API (Node.js) - Bundler: Webpack 5 - Linting: ESLint (`eslint-config-vscode-ext`) - Testing: Mocha + `@vscode/test-electron` ## Working Effectively Bootstrap and local setup: ```bash git submodule init git submodule update npm install ``` Build and development quickstart: ```bash npm run build npm run lint ``` - Use `npm run watch` during active development. - Use VS Code "Launch Extension" (F5) to validate behavior in Extension Development Host. - Expected command timings are usually under 10 seconds. - Never cancel `npm install`, `npm run watch`, or `npm test` once started. ## Build and Development Commands - `npm run compile` - TypeScript compilation - `npm run build` - Webpack development build - `npm run watch` - Continuous webpack build - `npm run lint` - ESLint validation - `npm run test` - Full test suite - `npm run vscode:prepublish` - Production build ## Testing and Validation Automated tests use the VS Code test runner and may fail in restricted environments due to VS Code download/network constraints. Manual validation checklist: 1. Run `npm run build` successfully. 2. Press F5 to launch Extension Development Host. 3. Toggle bookmarks (`0`-`9`) and validate gutter/line decoration updates. 4. Jump to existing and undefined bookmarks and verify behavior. 5. Validate persistence behavior across file reload and VS Code restart. If `npm test` fails with connectivity errors to VS Code download endpoints, treat this as environment-related unless code-level failures are present. ## Project Structure and Key Files ``` src/ ├── core/ # Core bookmark logic (Controller, File, Bookmark, operations) ├── decoration/ # Gutter and line decorations ├── sticky/ # Sticky bookmark engine (legacy and new) ├── storage/ # Workspace state persistence ├── quickpick/ # Quick pick UI components ├── utils/ # Utility functions (fs, reveal, revealLocation) ├── whats-new/ # What's New feature └── extension.ts # Main extension entry point dist/ # Webpack build output l10n/ # Localization files out/ # Compiled TypeScript files vscode-whats-new/ # Git submodule for What's New walkthrough/ # Getting Started walkthrough content ``` ## Coding Conventions and Patterns ### Indentation - Use spaces, not tabs. - Use 4 spaces for indentation. ### Naming Conventions - Use PascalCase for `type` names - Use PascalCase for `enum` values - Use camelCase for `function` and `method` names - Use camelCase for `property` names and `local variables` - Use whole words in names when possible ### Types - Do not export `types` or `functions` unless you need to share it across multiple components - Do not introduce new `types` or `values` to the global namespace - Prefer `const` over `let` when possible. ### Strings - Prefer double quotes for new code; some existing files may still use single quotes. - User-facing strings use two localization mechanisms: - **Manifest contributions** (commands, settings, walkthrough metadata): use `%key%` placeholders in `package.json`, with translations in `package.nls.json` and `package.nls.{LANGID}.json`. Do **not** use `l10n.t` for these. - **Runtime messages** (shown from extension code): use `l10n.t("message")`, with translations in `l10n/bundle.l10n.json` and `l10n/bundle.l10n.{LANGID}.json`. - Externalized strings must not use string concatenation. Use placeholders instead (`{0}`). ### Code Quality - All production source files under `src/` (excluding tests under `src/test`) must include the standard project copyright header - Prefer `async` and `await` over `Promise` and `then` calls - All user facing messages must be localized using the applicable localization framework (for example `l10n.t` method) - Keep imports organized: VS Code first, then internal modules. - Use semicolons at the end of statements. - Keep changes minimal and aligned with existing style. ### Import Organization - Import VS Code API first: `import * as vscode from "vscode"` - Group related imports together - Use named imports for specific VS Code types - Import from local modules using relative paths ### Architecture Patterns - **Container Pattern**: The `Container` class stores global state like `Container.context` - **Controller Pattern**: `Controller` class manages files and bookmarks per workspace folder - **File Pattern**: `File` class represents a document with its bookmarks - **Bookmark Pattern**: `Bookmark` interface with line and column positions - **Sticky Engine**: Two implementations (legacy and new) for maintaining bookmark positions during edits - **Decoration Pattern**: Separate decoration types for gutter icons and line backgrounds - **Event-Driven**: Heavy use of VS Code events (`onDidChangeConfiguration`, `onDidChangeTextDocument`, etc.) ## Extension Features and Configuration ### Key Features 1. **Bookmark management**: Commands 0-9 to mark/unmark positions 2. **Navigation**: Commands 0-9 to navigate to marked positions 3. **Selection**: select lines between bookmarks, expand/shrink selections 4. **Sidebar**: tree view showing all bookmarks organized by file 5. **Persistence**: Save bookmarks in workspace state or project files 6. **Sticky bookmarks**: Maintain bookmark positions during edits 7. **Multi-root workspace**: Manage bookmarks per workspace folder 8. **Remote Development**: Support for remote development scenarios 9. **Internationalization support**: Localization of all user-facing strings 10. **Customizable Appearance**: Gutter icons, line backgrounds, colors 11. **Walkthrough**: Getting Started guide for new users ### Important Settings - `numberedBookmarks.saveBookmarksInProject`: Save in `.vscode/numbered-bookmarks.json` - `numberedBookmarks.navigateThroughAllFiles`: How to navigate across files (false/replace/allowDuplicates) - `numberedBookmarks.gutterIconFillColor`: Gutter icon background color - `numberedBookmarks.experimental.enableNewStickyEngine`: Use new sticky engine (default: true) ## Dependencies and External Tools ### Production - `VS Code-ext-codicons`: Codicon support - `VS Code-ext-decoration`: Decoration utilities - `os-browserify`, `path-browserify`: Polyfills for browser compatibility ### Development - ESLint with `eslint-config-VS Code-ext` - TypeScript ^4.4.4 - Webpack 5 with ts-loader and terser plugin ## Troubleshooting and Known Limitations - **Bookmark #0**: Reactivated but has no keyboard shortcut due to OS limitations - **macOS Shortcuts**: Use `Cmd` instead of `Ctrl` for some shortcuts (Cmd+Shift+3, Cmd+Shift+4) - **Untitled Files**: Special handling for untitled documents - **Path Handling**: Cross-platform path handling (Windows backslashes vs. Unix forward slashes) - **Localization**: Support for multiple languages via l10n and package.nls.*.json files - **Walkthrough**: Extension includes a getting started walkthrough ## CI and Pre-Commit Validation Before committing: 1. Run `npm run lint`. 2. Run `npm run build`. 3. Run `npm run pretest`. ## Common Tasks ### Adding a New Command 1. Add command definition in `package.json` > `contributes.commands` 2. Add localized string in `package.nls.json` 3. Register command handler in `src/extension.ts` 4. Add keyboard binding if needed in `package.json` > `contributes.keybindings` 5. Update menu contributions if applicable ### Modifying Bookmark Behavior - Core logic in `src/core/operations.ts` - Sticky behavior in `src/sticky/sticky.ts` or `src/sticky/stickyLegacy.ts` - Visual updates in `src/decoration/decoration.ts` ### Adding Tests - Create test files in `src/test/suite/` - Follow existing test patterns with Mocha - Update test suite index if needed ================================================ FILE: .github/instructions/localization-pr-review.instructions.md ================================================ --- description: "Use when reviewing pull requests that add or update localization files (package.nls.*.json, bundle.l10n.*.json, walkthrough .nls.*.md files) for VS Code extensions. Validates key completeness, JSON syntax, placeholder preservation, and file structure." applyTo: "package.nls.*.json,l10n/bundle.l10n.*.json,walkthrough/*.nls.*.md" --- # Localization Pull Request Review Instructions These instructions guide the Copilot Code Review agent when reviewing pull requests that add or update localization files for the Numbered Bookmarks VS Code extension. ## Overview This extension supports multiple localization approaches: 1. **Package contributions** (`package.nls.*.json`) - for settings, commands, menus, views, and walkthrough metadata 2. **Walkthrough content** (`walkthrough/*.nls.*.md`) - for walkthrough step content 3. **Runtime messages** (`l10n/bundle.l10n.*.json`) - for messages displayed in extension code ## Language Code Format All language identifiers must follow the BCP 47 format and match VS Code's supported languages: - Use lowercase for language codes: `es`, `fr`, `pt-br`, `zh-cn`, `zh-tw` - Use hyphen separator for regional variants: `pt-br` (not `pt_br` or `pt-BR`) - Verify the language code is supported by VS Code ## File Naming Conventions ### Package Localization Files - **Pattern**: `package.nls.{LANGID}.json` - **Location**: Root directory - **Example**: `package.nls.es.json`, `package.nls.pt-br.json` ### Walkthrough Localization Files - **Pattern**: `{stepName}.nls.{LANGID}.md` - **Location**: `walkthrough/` directory - **Example**: `toggle.nls.es.md`, `navigateToNumberedBookmarks.nls.pt-br.md` ### Runtime Bundle Localization Files - **Pattern**: `bundle.l10n.{LANGID}.json` - **Location**: `l10n/` directory - **Example**: `bundle.l10n.es.json`, `bundle.l10n.pt-br.json` ## Critical Validation Checks ### 1. Key Completeness and Consistency **For `package.nls.*.json` files:** - ✅ All keys from `package.nls.json` must be present in the localized file - ✅ No extra keys should exist that aren't in the base file - ✅ Key names must match exactly (case-sensitive) - ❌ Missing keys mean incomplete localization - ❌ Extra keys indicate misalignment with base file **For `bundle.l10n.*.json` files:** - ✅ All keys from `l10n/bundle.l10n.json` must be present - ✅ Check for proper translation of variable placeholders (e.g., `{0}`, `{1}`) - ✅ Preserve format specifiers and escape sequences **For walkthrough `.nls.*.md` files:** - ✅ Corresponding base `.md` file must exist - ✅ Markdown structure should be preserved (headings, lists, links) - ✅ Command links must remain functional: `[text](command:commandId)` ### 2. JSON Format and Syntax - ✅ Valid JSON syntax (no trailing commas, proper quotes, balanced braces) - ✅ UTF-8 encoding without BOM - ✅ Consistent indentation (4 spaces per the project's style) - ✅ Keys and values properly quoted with double quotes - ✅ Proper escaping of special characters (`\n`, `\"`, `\\`) - ❌ No single quotes for strings - ❌ No comments in JSON files ### 3. Translation Quality Indicators While you cannot verify translation accuracy, watch for: - ⚠️ Values that are identical to the English version (may indicate incomplete translation) - ⚠️ Missing diacritics or special characters expected in the target language - ⚠️ Broken variable placeholders: `{0}`, `{1}` must be preserved - ⚠️ Broken markdown links or command references in walkthrough files - ⚠️ Inconsistent use of terms across the same file ### 4. Structural Integrity **Package files:** - ✅ Structure matches `package.nls.json` exactly - ✅ Nested properties preserved (e.g., `"numberedBookmarks.commands.toggleBookmark0.title"`) - ✅ Array elements and object structures maintained **Bundle files:** - ✅ Multi-line strings preserve `\n` characters - ✅ Format placeholders maintained: `{0}`, `{1}`, etc. - ✅ Contextual consistency with surrounding text **Walkthrough files:** - ✅ Markdown syntax valid - ✅ Command links intact: `(command:numberedBookmarks.toggleBookmark0)` - ✅ Image references preserved - ✅ Code blocks and formatting maintained ### 5. Full Localization Pack Validation When a new language is added, ensure that all three types of localization files are included: - `package.nls.{LANGID}.json` - `l10n/bundle.l10n.{LANGID}.json` - Walkthrough `.nls.{LANGID}.md` files for all steps ## Common Issues to Flag ### High Priority Issues ❌ 1. **Missing keys** - Incomplete localization ``` Missing keys: ["numberedBookmarks.commands.toggleBookmark0.title", "numberedBookmarks.commands.toggleBookmark1.title"] ``` 2. **Invalid JSON syntax** - File cannot be parsed ``` Syntax error at line 45: Unexpected token , ``` 3. **Broken placeholders** - Runtime errors possible ``` English: "One of the projects in the workspace has a bookmarks file. The most recent was modified at {0}" Localized: "Uno de los proyectos tiene un archivo. Modificado recientemente" // Missing {0} ``` 4. **Wrong file location** - Files won't be loaded ``` ❌ src/l10n/bundle.l10n.es.json (wrong location) ✅ l10n/bundle.l10n.es.json (correct location) ``` 5. **Incomplete localization pack** - Missing files for a new language ``` ❌ Missing files for language 'es': - `package.nls.es.json` - `l10n/bundle.l10n.es.json` - Walkthrough `.nls.es.md` files ``` ### Medium Priority Issues ⚠️ 1. **Extra keys** - May indicate stale translations ``` Extra keys not in base file: ["numberedBookmarks.commands.oldCommand.title"] ``` 2. **Untranslated values** - Values identical to English ``` "numberedBookmarks.commands.toggleBookmark0.title": "Toggle Bookmark 0" // Appears untranslated ``` 3. **Inconsistent formatting** - Reduce diff noise ``` // Inconsistent indentation or line endings ``` ### Low Priority Issues ℹ️ 1. **Missing newline at end of file** 2. **Inconsistent quote escaping** (if functionally equivalent) 3. **Whitespace inconsistencies** (if not affecting output) ## Review Checklist When reviewing a localization PR, verify: - [ ] Language code is correctly formatted and consistent - [ ] Files are placed in the correct directories - [ ] File naming follows conventions exactly - [ ] All required keys are present (compare with base files) - [ ] No extra keys exist that aren't in base files - [ ] JSON syntax is valid (run through JSON validator) - [ ] UTF-8 encoding is used - [ ] Indentation matches project style (4 spaces) - [ ] Variable placeholders `{0}`, `{1}`, etc. are preserved - [ ] Escape sequences `\n`, `\"` are properly maintained - [ ] Markdown links and commands are intact (walkthrough files) - [ ] No obvious machine translation artifacts (if detectable) ## Helpful Review Comments ### For Missing Keys ``` ⚠️ This localization is missing the following keys that exist in the base file: - `numberedBookmarks.commands.toggleBookmark0.title` - `numberedBookmarks.commands.toggleBookmark1.title` Please add these keys with appropriate translations. ``` ### For Extra Keys ``` ⚠️ This file contains keys that don't exist in the base file: - `numberedBookmarks.commands.oldFeature.title` These may be from an older version. Please remove them or verify they're still needed. ``` ### For Broken Placeholders ``` ❌ The placeholder `{0}` is missing in this translation: - English: "The project's file was last modified at {0}" - Localized: "El archivo del proyecto fue modificado" Please include the `{0}` placeholder to show the modification time. ``` ### For Structural Issues ``` ❌ Invalid JSON syntax detected at line 23. Please ensure: - All keys and values are enclosed in double quotes - No trailing commas after the last item - All braces and brackets are properly balanced ``` ### For Untranslated Content ``` ℹ️ Some values appear to be identical to English. Please verify these are intentionally untranslated or if they should be localized: - `numberedBookmarks.configuration.title`: "Numbered Bookmarks" - `numberedBookmarks.walkthroughs.label`: "Get Started with Numbered Bookmarks" (Note: Some terms like "Bookmarks" may be intentionally kept in English depending on localization guidelines) ``` ## Automated Checks to Run If possible, recommend or run: 1. **JSON validation**: `jq . package.nls.{LANGID}.json` or Node.js `JSON.parse()` 2. **Key comparison**: Compare keys between base and localized files 3. **Encoding check**: Verify UTF-8 encoding 4. **Placeholder verification**: Regex to find `{n}` patterns and ensure they match ## Exceptions and Edge Cases 1. **Product names** - May remain in English: "Numbered Bookmarks", "VS Code" 2. **Technical terms** - Some terms may be transliterated rather than translated 3. **Command IDs** - Must never be translated: `command:numberedBookmarks.toggleNumbered0` 4. **Setting keys** - Must never be translated: `numberedBookmarks.saveBookmarksInProject` 5. **Partial translations** - In-progress work may have some untranslated strings; verify with PR description ## Final Recommendation Format Provide a structured review: ```markdown ## Localization Review Summary **Language**: {language name} ({language code}) **Files Changed**: {count} files ### ✅ Passed Checks - All required keys present - Valid JSON syntax - Proper file locations - Placeholders preserved ### ⚠️ Issues Found 1. [Priority] {Issue description} in {file}:{line} 2. [Priority] {Issue description} in {file}:{line} ### 💡 Suggestions - {Optional improvement suggestion} ### Overall Assessment {Approve / Request Changes / Comment} ``` ## Resources - [VS Code Extension Localization Guide](https://code.visualstudio.com/api/extension-guides/localization) - [BCP 47 Language Codes](https://tools.ietf.org/html/bcp47) - Project localization skill: `.github/skills/vscode-ext-localization/SKILL.md` ================================================ FILE: .github/pull_request_template.md ================================================ ## Description --- ## Prerequisites Checklist - [ ] The code is **up-to-date with the `master` branch** - [ ] I have reviewed the [CONTRIBUTING.md](../CONTRIBUTING.md) guidelines - [ ] The code **follows the repository's coding style** (TypeScript conventions, formatting, naming) - [ ] All changes are **testable and have been manually tested** --- ## Regular PR If your PR is a regular PR, to fix an issue, provide a new feature or change a behavior, follow this additional checklist: - [ ] This PR must address an **existing issue** ### Changes Made --- ## Localization PR If your PR is related to localization, follow this additional checklist: - [ ] Identify the language code, like "pt-br" _(There is no need to identify the language name)_ - [ ] All UI strings have been added/updated to `package.nls.json` - [ ] All translations were added/updated to the corresponding `package.nls..json` file(s) - [ ] All new messages and strings located in extension source code have been added/updated to `l10n/bundle.l10n.json` - [ ] All translations were added/updated to the corresponding `l10n/bundle.l10n..json` file(s) - [ ] All walkthrough content has been added/updated to their `Markdown` files - [ ] All translations were added/updated to the corresponding `walkthrough/someStep.pt-br.md` file(s) --- ## Testing - [ ] Tested locally with the extension running in VS Code - [ ] Tested on Windows (if applicable) - [ ] Tested on macOS (if applicable) - [ ] Tested on Linux (if applicable) - [ ] Tested on Remotes (Containers, WSL, etc.) - [ ] Verified existing functionality still works (no regressions) ## Documentation - [ ] Updated [README.md](../README.md) if adding user-facing features (if applicable) ## Additional Notes ================================================ FILE: .github/skills/vscode-ext-commands/SKILL.md ================================================ --- name: vscode-ext-commands description: 'Guidelines for contributing commands in VS Code extensions. Indicates naming convention, visibility, localization and other relevant attributes, following VS Code extension development guidelines, libraries and good practices' --- # VS Code extension command contribution This skill helps you to contribute commands in VS Code extensions ## When to use this skill Use this skill when you need to: - Add or update commands to your VS Code extension # Instructions VS Code commands must always define a `title`, independent of its category, visibility or location. We use a few patterns for each "kind" of command, with some characteristics, described below: * Regular commands: By default, all commands should be accessible in the Command Palette, must define a `category`, and don't need an `icon`, unless the command will be used in the Side Bar. * Side Bar commands: Its name follows a special pattern, starting with underscore (`_`) and suffixed with `#sideBar`, like `_extensionId.someCommand#sideBar` for instance. Must define an `icon`, and may or may not have some rule for `enablement`. Side Bar exclusive commands should not be visible in the Command Palette. Contributing it to the `view/title` or `view/item/context`, we must inform _order/position_ that it will be displayed, and we can use terms "relative to other command/button" in order to you identify the correct `group` to be used. Also, it's a good practice to define the condition (`when`) for the new command is visible. ================================================ FILE: .github/skills/vscode-ext-localization/SKILL.md ================================================ --- name: vscode-ext-localization description: 'Guidelines for proper localization of VS Code extensions, following VS Code extension development guidelines, libraries and good practices' --- # VS Code extension localization This skill helps you localize every aspect of VS Code extensions ## When to use this skill Use this skill when you need to: - Localize new or existing contributed configurations (settings), commands, menus, views or walkthroughs - Localize new or existing messages or other string resources contained in extension source code that are displayed to the end user # Instructions VS Code localization is composed by three different approaches, depending on the resource that is being localized. When a new localizable resource is created or updated, the corresponding localization for all currently available languages must be created/updated. 1. Configurations like Settings, Commands, Menus, Views, ViewsWelcome, Walkthrough Titles and Descriptions, defined in `package.json` -> An exclusive `package.nls.LANGID.json` file, like `package.nls.pt-br.json` of Brazilian Portuguese (`pt-br`) localization 2. Walkthrough content (defined in its own `Markdown` files) -> An exclusive `Markdown` file like `walkthrough/someStep.pt-br.md` for Brazilian Portuguese localization 3. Messages and string located in extension source code (JavaScript or TypeScript files) -> An exclusive `bundle.l10n.pt-br.json` for Brazilian Portuguese localization ================================================ FILE: .github/workflows/main.yml ================================================ name: CI # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: push: branches: [ master ] pull_request: branches: [ master ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout uses: actions/checkout@v4 with: submodules: true # Runs a set of commands using the runners shell - name: Install Node.js uses: actions/setup-node@v4 with: node-version: 22.x cache: 'npm' # Runs the tests - name: Cache VS Code downloads uses: actions/cache@v4 with: path: .vscode-test key: vscode-test-${{ matrix.os }}-${{ hashFiles('**/package.json') }} restore-keys: | vscode-test-${{ matrix.os }}- - run: npm ci - run: xvfb-run -a npm test if: runner.os == 'Linux' - run: npm test if: runner.os != 'Linux' ================================================ FILE: .gitignore ================================================ out node_modules .vscode-test/ *.vsix dist images/bookmark?*.svg ================================================ FILE: .gitmodules ================================================ [submodule "vscode-whats-new"] path = vscode-whats-new url = https://github.com/alefragnani/vscode-whats-new.git ================================================ FILE: .vscode/bookmarks.json ================================================ { "bookmarks": [ { "fsPath": "$ROOTPATH$\\extension.ts", "bookmarks": [ 638 ] } ] } ================================================ FILE: .vscode/extensions.json ================================================ { // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp // List of extensions which should be recommended for users of this workspace. "recommendations": [ "dbaeumer.vscode-eslint", "eamodio.tsl-problem-matcher", ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [ ] } ================================================ FILE: .vscode/launch.json ================================================ // A launch configuration that compiles the extension and then opens it inside a new window { "version": "0.2.0", "configurations": [ { "name": "Launch Extension", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], "stopOnEntry": false, "outFiles": ["${workspaceFolder}/dist/**/*.js"], // "skipFiles": ["/**", "**/node_modules/**", "**/app/out/vs/**", "**/extensions/**"], "smartStep": true, "sourceMaps": true }, { "name": "Launch Tests", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": [ "--disable-extensions", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/src/test/suite/index" ], "outFiles": [ "${workspaceFolder}/out/src/test/**/*.js" ], "preLaunchTask": "npm: test-compile" }, { "name": "Run Web Extension in VS Code", "type": "pwa-extensionHost", "debugWebWorkerHost": true, "request": "launch", "args": [ "--extensionDevelopmentPath=${workspaceFolder}", "--extensionDevelopmentKind=web" ], "outFiles": ["${workspaceFolder}/dist/**/*.js"], "preLaunchTask": "npm: watch" } ] } ================================================ FILE: .vscode/numbered-bookmarks.json ================================================ { "bookmarks": [ { "fsPath": "$ROOTPATH$\\package.json", "bookmarks": [ -1, 19, 13, -1, -1, -1, -1, -1, -1, -1 ] } ] } ================================================ FILE: .vscode/settings.json ================================================ // Place your settings in this file to overwrite default and user settings. { "files.exclude": { "out": false // set this to true to hide the "out" folder with the compiled JS files }, "search.exclude": { "out": true } } ================================================ FILE: .vscode/tasks.json ================================================ { "version": "2.0.0", "presentation": { "echo": false, "reveal": "always", "focus": false, "panel": "dedicated", "showReuseMessage": false }, "tasks": [ { "type": "npm", "script": "build", "group": "build", "problemMatcher": ["$ts-webpack", "$tslint-webpack"] }, { "type": "npm", "script": "watch", "group": { "kind": "build", "isDefault": true }, "isBackground": true, "problemMatcher": ["$ts-webpack-watch", "$tslint-webpack-watch"] } ] } ================================================ FILE: .vscodeignore ================================================ .vscode/** .vscode-test/** typings/** **/*.ts **/*.map out/** node_modules/** .gitignore tsconfig.json test/** *.vsix package-lock.json webpack.config.js **/.github/ **/.git/** **/.git **/.gitmodules .devcontainer/ images/bookmark?-*.svg ================================================ FILE: AGENTS.md ================================================ # Numbered Bookmarks Agents Instructions Agents working in this repository should read the main instructions first: [Copilot Instructions](.github/copilot-instructions.md). ## Use this file for - Finding the authoritative workflow for edits and validation. - Keeping command, configuration, and localization changes consistent. - Applying minimal, safe changes aligned with repository conventions. ## Typical agent tasks - Update extension manifest contributions and related localization keys. - Adjust source/configuration files and run repository validation commands. - Verify build, lint, and Extension Development Host checks before finishing. ================================================ FILE: CHANGELOG.md ================================================ ## [9.0.0] - 2025-12-13 ### Added - Fully Open Source again (issue [#131](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/131)) ### Fixed - Reuse opened file (issue [#180](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/180)) ### Internal - Security Alert: word-wrap (dependabot [PR #167](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/167)) - Security Alert: webpack (dependabot [PR #178](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/178)) - Security Alert: serialize-javascript (dependabot [PR #183](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/183)) - Security Alert: braces (dependabot [PR #176](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/176)) ## [8.5.0] - 2024-04-04 ### Added - Published to Open VSX (issue [#147](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/147)) - New setting to choose viewport position on navigation (issue [#141](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/141)) ## [8.4.0] - 2023-07-19 ### Added - Getting Started/Walkthrough (issue [#117](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/117)) - Localization (l10n) support (issue [#151](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/151)) ### Changed - Avoid What's New when using Gitpod (issue [#168](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/168)) - Avoid What's New when installing lower versions (issue [#168](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/168)) ### Fixed - Repeated gutter icon on line wrap (issue [#149](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/149)) ### Internal - Switch initialization to `onStartupFinished` API (issue [#145](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/145)) - Security Alert: webpack (dependabot [PR #156](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/156)) - Security Alert: terser (dependabot [PR #143](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/143)) ## [8.3.1] - 2022-07-17 ### Internal - Add GitHub Sponsors support (PR [#142](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/142)) ## [8.3.0] - 2022-05-07 ### Added - New setting to decide if should delete bookmark if associated line is deleted (issue [#27](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/27)) - Update bookmark reference on file renames (issue [#120](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/120)) ### Changed - Replace custom icons with _on the fly_ approach (issue [#129](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/129)) ## [8.2.0] - 2022-01-12 ### Added - New **Sticky Engine** with improved support to Formatters, Multi-cursor and Undo operations (issue [#115](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/115)) ### Changed - Removed deprecated setting `backgroundLineColor` (issue [#116](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/116)) ### Fixed - Bookmarks removes on Undo (issue [#47](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/47)) ## [8.1.0] - 2021-06-09 ### Added - Support **Virtual Workspaces** (issue [#107](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/107)) - Support **Workspace Trust** (issue [#108](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/108)) - Support Translation (issue [#112](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/112)) - Return to line/column when cancel List or List from All Files (issue [#96](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/96)) ### Internal - Security Alert: lodash (dependabot [PR #109](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/109)) - Security Alert: ssri (dependabot [PR #106](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/106)) - Security Alert: y18n (dependabot [PR #104](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/104)) ## [8.0.3] - 2021-03-20 ### Fixed - Bookmarks on deleted/missing files breaks jumping (issue [#102](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/102)) - Running the contributed command: 'numberedBookmarks.toggleBookmark1' failed (issue [#100](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/100)) - Toggling bookmarks on Untitled documents does not work bug (issue [#99](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/99)) ## [8.0.2] - 2021-02-25 ### Fixed - Command `Toggle` not found - loading empty workspace with random files (issue [#97](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/97)) ## [8.0.1] - 2021-02-15 ### Fixed - Extension does not activate on VS Code 1.50 (issue [#98](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/98)) ## [8.0.0] - 2021-02-11 ### Added - Improvements on multi-root support (issue [#92](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/92)) - Multi-platform support (issue [#94](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/94)) - Support Remote Development (issue [#63](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/63)) - Support Column position (issue [#14](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/14)) ### Fixed - Error using `Toggle Bookmark` command with `saveBookmarksInProject` (issue [#69](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/69)) ### Internal - Do not show welcome message if installed by Settings Sync (issue [#95](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/95)) ## [7.3.0] - 2021-01-12 ### Added - Support submenu for editor commands (issue [#84](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/84)) - New setting to decide if should show a warning when a bookmark is not defined (issue [#73](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/73)) ### Fixed - Typo in extension's configuration title (issue [#89](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/89)) ### Internal - Shrink installation size (issue [#53](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/53)) - Update whats-new submodule API (issue [#85](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/85)) ## [7.2.0] - 2020-09-16 ### Internal - Use `vscode-ext-codicons` package (issue [#80](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/80)) - Migrate from TSLint to ESLint (issue [#75](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/75)) ## [7.1.3] - 2020-08-05 ### Fixed - Security Alert: elliptic (dependabot [PR #79](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/79)) - Security Alert: lodash (dependabot [PR #77](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/77)) ## [7.1.2] - 2020-06-20 ### Fixed - Stars visibility on Marketplace (issue [#76](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/76)) ## [7.1.1] - 2020-05-10 ### Fixed - View context menu displayed erroneously (issue [#72](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/72)) ## [7.1.0] - 2020-05-09 ### Fixed - Navigation error on empty files (issue [#68](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/68)) ### Internal - Support VS Code extension view context menu ## [7.0.0] - 2020-02-07 ### Added - Support `workbench.colorCustomizations` (issue [#61](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/61)) ### Internal - Support VS Code package split - Use `vscode-ext-decoration` package ## [6.2.1] - 2019-05-27 ### Fixed - Security Alert: tar ## [6.2.0] - 2019-03-25 ### Added - Improvements to README, describing commands and shortcuts (issue [#52](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/52)) - Improvements to README, describing shortcut conflicts for MacOS users (issue [#40](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/40)) ### Fixed - Selection issue when cutting text (issue [#48](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/48)) ## [6.1.1] - 2019-03-15 ### Fixed - What's New page broken in VS Code 1.32 due to CSS API changes ## [6.1.0] - 2018-12-17 ### Added - New settings to choose gutter icon colors (icon fill and number) (Thanks to @vasilev-alex [PR #45](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/45)) ## [6.0.0] - 2018-11-26 ### Added - What's New ## [5.2.0] - 2018-09-14 ### Added - New Setting to choose background color of bookmarked lines (Thanks to @ibraimgm [PR #44](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/44)) - New Version Numbering based on `semver` ## [0.12.0 - 5.1.0] - 2018-09-14 ### Added - Patreon button ## [0.11.1 - 5.0.1] - 2018-03-09 ### Fixed - Error activating extension without workspace (folder) open (issue [#35](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/35)) ## [0.11.0 - 5.0.0] - 2017-11-13 ### Added - Multi-root support (issue [#30](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/30)) ## [0.10.0 - 4.0.0] - 2017-05-27 ### Changed - **TypeScript** and **VS Code engine** updated - Source code moved to `src` folder - Enabled **TSLint** - Source code organization ### Fixed - Error opening files outside the project in `List from All Files` (issue [#26](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/26)) - `List from All Files` command not working since VS Code 1.12 (issue [#25](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/25)) ## [0.9.1 - 3.1.1] - 2017-05-11 ### Fixed - Bookmarks disapearing/incorrectly moving when new lines are added above (issue [#23](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/23)) ## [0.9.0 - 3.1.0] - 2017-04-23 ### Added - New Setting to choose how bookmarks _Navigate Through All Files_ (issue [#6](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/6)) ## [0.8.0 - 3.0.0] - 2017-04-02 ### Added - New Setting to allow Bookmarks to be saved in the project (inside `.vscode` folder) ### Changed - Bookmarks are now _always_ Sticky ## [0.7.0 - 2.4.0] - 2017-03-06 ### Added - Avoid unnecessary scrolling (issue [#18](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/18)) ## [0.6.0 - 2.3.0] - 2017-01-03 ### Added - Toggle Bookmark 0 and Jump to Bookmark 0 (PR [#16](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/16) - kudos to @DeegC) ## [0.5.2 - 2.2.2] - 2016-12-03 ### Added - Tags added for Marketplace presentation ## [0.5.1 - 2.2.1] - 2016-12-03 ### Fixed - Bookmarks becomes invalid when documents are modified outside VSCode ## [0.5.0 - 2.2.0] - 2016-09-26 ### Added - New Command `List from all files` - New Command `Clear from all files` ## [0.4.2 - 2.1.2] - 2016-09-19 ### Fixed - Bookmarks missing in _Insider release 1.6.0_ (issue [#11](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/11)) ## [0.4.1 - 2.1.1] - 2016-09-03 ### Fixed - Remove extension activation log (issue [#10](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/10)) ## [0.4.0 - 2.1.0] - 2016-06-17 ### Added - New Setting to Sticky Bookmarks ## [0.3.0 - 2.0.0] - 2016-03-08 ### Added - Bookmarks are also rendered in the overview ruler ### Fixed - Incompatibility with **Code February Release** 0.10.10 (issue [#4](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/4)) ## [0.2.0 - 1.0.0] - 2016-02-15 ### Added - New Command `List` ## [0.1.0 - 0.9.0] - 2016-02-06 * Initial release ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing First off all, thank you for taking the time to contribute! When contributing to this project, please first discuss the changes you wish to make via an issue before making changes. ## Your First Code Contribution Unsure where to begin contributing? You can start by looking through the [`help wanted`](https://github.com/alefragnani/vscode-numbered-bookmarks/labels/good%20first%20issue) issues. ### Getting the code ``` git clone https://github.com/alefragnani/vscode-numbered-bookmarks.git ``` Prerequisites - [Git](https://git-scm.com/), `>= 2.22.0` - [NodeJS](https://nodejs.org/), `>= 18.17.0` ### Dependencies From a terminal, where you have cloned the repository, execute the following command to install the required dependencies: ``` git submodule init git submodule update npm install ``` ### Build / Watch From inside VS Code, run `Tasks: Run Task Build`. It **Builds** the extension in **Watch Mode**. This will first do an initial full build and then watch for file changes, compiling those changes incrementally, enabling a fast, iterative coding experience. > **Tip!** You can press Cmd+Shift+B (Ctrl+Shift+B on Windows, Linux) to start the watch task. > **Tip!** You don't need to stop and restart the development version of Code after each change. You can just execute `Reload Window` from the command palette. ### Linting This project uses [ESLint](https://eslint.org/) for code linting. You can run ESLint across the code by calling `npm run lint` from a terminal. Warnings from ESLint show up in the `Errors and Warnings` quick box and you can navigate to them from inside VS Code. To lint the code as you make changes you can install the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension. ### Debugging 1. Open the `vscode-numbered-bookmarks` folder 2. Ensure the required [dependencies](#dependencies) are installed 3. Choose the `Launch Extension` launch configuration from the launch dropdown in the Run and Debug viewlet and press `F5`. ## Submitting a Pull Request Be sure your branch is up to date (relative to `master`) and submit your PR. Also add reference to the issue the PR refers to. ================================================ FILE: LICENSE.md ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================


Numbered Bookmarks Logo

# What's new in Numbered Bookmarks 9 * Fully Open Source again * Published to **Open VSX** * Adds **Getting Started / Walkthrough** * Adds **Rename file** support * New **Sticky Engine** # Support **Numbered Bookmarks** is an extension created for **Visual Studio Code**. If you find it useful, please consider supporting it.
# Numbered Bookmarks It helps you to navigate in your code, moving between important positions easily and quickly. No more need to _search for code_. All of this in **_in Delphi style_**. # Features ## Available commands * `Numbered Bookmarks: Toggle Bookmark '#number'` Mark/unmark the current position with a numbered bookmark * `Numbered Bookmarks: Jump to Bookmark '#number'` Move the cursor to the numbered bookmark * `Numbered Bookmarks: List` List all bookmarks from the current file * `Numbered Bookmarks: List from All Files` List all bookmarks from the all files * `Numbered Bookmarks: Clear` remove all bookmarks from the current file * `Numbered Bookmarks: Clear from All Files` remove all bookmarks from the all files > Both **Toggle Bookmark** and **Jump to Bookmark** commands are numbered from 0 to 9 > The Numbered Bookmark **0** has been reactivated in [PR #16](https://github.com/alefragnani/vscode-numbered-bookmarks/pull/16), but because of [this issue](https://github.com/Microsoft/vscode/issues/2585) it has no _keyboard shortcut_ defined. If sometime in the future these OS related limitation disappears, the shortcuts will be restored. > MacOS users should be aware that some commands shortcuts should conflict with native shortcuts, and uses `Cmd` instead of `Ctrl` (`Cmd + Shift + 3` and `Cmd + Shift + 4`) ## Manage your bookmarks ### Toggle Bookmark '#number' You can easily Mark/Unmark bookmarks on any position. ![Toggle](images/numbered-bookmarks-toggle.png) > The default shortcuts are numbered from 0 to 9: `Toggle Bookmark #` (`Ctrl + Shift + #`) ### Navigation ### Jump to Bookmark '#number' > The default shortcuts are numbered from 0 to 9: `Jump to Bookmark #` (`Ctrl + #`) ### List List all bookmarks from the current file and easily navigate to any one. It shows you the line contents and temporarily scroll to that position. ### List from All Files List all bookmarks from all files and easily navigate to any one. It shows you the line contents and temporarily scroll to that position. ![List](images/numbered-bookmarks-list-from-all-files.gif) * Bookmarks from the active file shows the line content and the position * Bookmarks from other files also shows the relative file path ### Improved Multi-root support When you work with **multi-root** workspaces, the extension can manage the bookmarks individually for each folder. Simply define `saveBookmarksInProject` as `true` on your **User Settings** or in the **Workspace Settings**, and when you run the `Numbered Bookmarks: List from All Files` command, you will be able to select from which folder the bookmarks will be shown. ![List](images/numbered-bookmarks-list-from-all-files-multi-root.gif) ### Remote Development support The extension now fully supports **Remote Development** scenarios. It means that when you connect to a _remote_ location, like a Docker Container, SSH or WSL, the extension will be available, ready to be used. > You don't need to install the extension on the remote anymore. Better yet, if you use `numberedBookmarks.saveBookmarksInProject` setting defined as `true`, the bookmarks saved locally _will be available_ remotely, and you will be able to navigate and update the bookmarks. Just like it was a resource from folder you opened remotely. ## Available Settings * Bookmarks are always saved between sessions, and you can decide if it should be saved _in the Project_, so you can add it to your Git/SVN repo and have it in all your machines _(`false` by default)_. Set to `true` and it will save the bookmarks in `.vscode\numbered-bookmarks.json` file. ```json "numberedBookmarks.saveBookmarksInProject": true ``` * Controls whether to show a warning when a bookmark is not defined _(`false` by default)_ ```json "numberedBookmarks.showBookmarkNotDefinedWarning": true ``` * Per [User Requests](https://github.com/alefragnani/vscode-numbered-bookmarks/issues/6) it is now possible to choose how Bookmarks _Navigate Through All Files_: ```json "numberedBookmarks.navigateThroughAllFiles" ``` Possible Values: Value | Explanation --------- | --------- `false` | _default_ - same behavior as today `replace` | you can't have the same numbered bookmark in different files `allowDuplicates` | you can have the same numbered bookmark in different files, and if you jump repeatedly to the same number, it will look on other files * **Experimental**. Enables the new **Sticky engine** with support for Formatters, improved source change detections and undo operations _(`true` by default)_ ```json "numberedBookmarks.experimental.enableNewStickyEngine": false ``` * "Specifies whether bookmarks on deleted line should be kept on file, moving it down to the next line, instead of deleting it with the line where it was toggled." _(`false` by default)_ ```json "numberedBookmarks.keepBookmarksOnLineDelete": true ``` > **Limitation:** It does not support `Undo` operations. It means that, once you delete a line and the bookmark is moved to the next available line, the `Undo` operation won't move the bookmark back to the previous line. The next line is now the new location of the bookmark. * Choose the gutter icon fill color ```json "numberedBookmarks.gutterIconFillColor" ``` * Choose the gutter icon number color ```json "numberedBookmarks.gutterIconNumberColor" ``` * Choose the location where the bookmarked line will be revealed _(`center` by default)_ * `top`: Reveals the bookmarked line at the top of the editor * `center`: Reveals the bookmarked line in the center of the editor ```json "numberedBookmarks.revealPosition": "center" ``` ## Available Colors * Choose the background color to use on a bookmarked line ```json "workbench.colorCustomizations": { "numberedBookmarks.lineBackground": "#157EFB22" } ``` * Choose the border color to use on a bookmarked line ```json "workbench.colorCustomizations": { "numberedBookmarks.lineBorder": "#FF0000" } ``` * Choose marker color to use in the overview ruler ```json "workbench.colorCustomizations": { "numberedBookmarks.overviewRuler": "#157EFB88" } ``` > For any of the _Color_ settings, you can use color names `blue`, RGB `rgb(0, 255, 37)`, RGBA `rgba(0, 255, 37, 0.2)` or HEX `#00ff25` format. ## Project and Session Based The bookmarks are saved _per session_ for the project that you are using. You don't have to worry about closing files in _Working Files_. When you reopen the file, the bookmarks are restored. It also works even if you only _preview_ a file (simple click in TreeView). You can put bookmarks in any file and when you preview it again, the bookmarks will be there. # License [GPL-3.0](LICENSE.md) © Alessandro Fragnani ================================================ FILE: l10n/bundle.l10n.json ================================================ { "No Bookmarks found": "No Bookmarks found", "Type a line number or a piece of code to navigate to": "Type a line number or a piece of code to navigate to", "The Bookmark {0} is not defined": "The Bookmark {0} is not defined", "Select a workspace": "Select a workspace", "Error loading Numbered Bookmarks: {0}": "Error loading Numbered Bookmarks: {0}" } ================================================ FILE: l10n/bundle.l10n.pt-br.json ================================================ { "No Bookmarks found": "Nenhum Bookmark encontrado", "Type a line number or a piece of code to navigate to": "Digite um número de linha ou pedaço de código para navegar", "The Bookmark {0} is not defined": "O Bookmark {0} não está definido", "Select a workspace": "Selecione um workspace", "Error loading Numbered Bookmarks: {0}": "Erro lendo Numbered Bookmarks: {0}" } ================================================ FILE: package.json ================================================ { "name": "numbered-bookmarks", "displayName": "Numbered Bookmarks", "description": "Mark lines and jump to them, in Delphi style", "version": "9.0.0", "publisher": "alefragnani", "engines": { "vscode": "^1.73.0" }, "extensionKind": [ "ui", "workspace" ], "capabilities": { "virtualWorkspaces": true, "untrustedWorkspaces": { "supported": true } }, "categories": [ "Other" ], "keywords": [ "bookmark", "sticky", "jump", "mark", "navigation", "Delphi", "multi-root ready" ], "icon": "images/icon.png", "license": "GPL-3.0", "homepage": "https://github.com/alefragnani/vscode-numbered-bookmarks/blob/master/README.md", "repository": { "type": "git", "url": "https://github.com/alefragnani/vscode-numbered-bookmarks.git" }, "bugs": { "url": "https://github.com/alefragnani/vscode-numbered-bookmarks/issues" }, "sponsor": { "url": "https://github.com/sponsors/alefragnani" }, "activationEvents": [ "onStartupFinished" ], "main": "./dist/extension-node.js", "l10n": "./l10n", "contributes": { "commands": [ { "command": "numberedBookmarks.toggleBookmark0", "title": "%numberedBookmarks.commands.toggleBookmark0.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark1", "title": "%numberedBookmarks.commands.toggleBookmark1.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark2", "title": "%numberedBookmarks.commands.toggleBookmark2.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark3", "title": "%numberedBookmarks.commands.toggleBookmark3.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark4", "title": "%numberedBookmarks.commands.toggleBookmark4.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark5", "title": "%numberedBookmarks.commands.toggleBookmark5.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark6", "title": "%numberedBookmarks.commands.toggleBookmark6.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark7", "title": "%numberedBookmarks.commands.toggleBookmark7.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark8", "title": "%numberedBookmarks.commands.toggleBookmark8.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.toggleBookmark9", "title": "%numberedBookmarks.commands.toggleBookmark9.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark0", "title": "%numberedBookmarks.commands.jumpToBookmark0.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark1", "title": "%numberedBookmarks.commands.jumpToBookmark1.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark2", "title": "%numberedBookmarks.commands.jumpToBookmark2.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark3", "title": "%numberedBookmarks.commands.jumpToBookmark3.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark4", "title": "%numberedBookmarks.commands.jumpToBookmark4.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark5", "title": "%numberedBookmarks.commands.jumpToBookmark5.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark6", "title": "%numberedBookmarks.commands.jumpToBookmark6.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark7", "title": "%numberedBookmarks.commands.jumpToBookmark7.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark8", "title": "%numberedBookmarks.commands.jumpToBookmark8.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.jumpToBookmark9", "title": "%numberedBookmarks.commands.jumpToBookmark9.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.list", "title": "%numberedBookmarks.commands.list.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.listFromAllFiles", "title": "%numberedBookmarks.commands.listFromAllFiles.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.clear", "title": "%numberedBookmarks.commands.clear.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.clearFromAllFiles", "title": "%numberedBookmarks.commands.clearFromAllFiles.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.whatsNew", "title": "%numberedBookmarks.commands.whatsNew.title%", "category": "Numbered Bookmarks" }, { "command": "numberedBookmarks.whatsNewContextMenu", "title": "%numberedBookmarks.commands.whatsNewContextMenu.title%" } ], "submenus": [ { "id": "numberedBookmarks.context.toggle", "label": "%numberedBookmarks.context.toggle.label%" }, { "id": "numberedBookmarks.context.jump", "label": "%numberedBookmarks.context.jump.label%" } ], "configuration": { "type": "object", "title": "%numberedBookmarks.configuration.title%", "properties": { "numberedBookmarks.saveBookmarksInProject": { "type": "boolean", "default": false, "description": "%numberedBookmarks.configuration.saveBookmarksInProject.description%" }, "numberedBookmarks.experimental.enableNewStickyEngine": { "type": "boolean", "default": true, "description": "%numberedBookmarks.configuration.experimental.enableNewStickyEngine.description%" }, "numberedBookmarks.keepBookmarksOnLineDelete": { "type": "boolean", "default": false, "description": "%numberedBookmarks.configuration.keepBookmarksOnLineDelete.description%" }, "numberedBookmarks.showBookmarkNotDefinedWarning": { "type": "boolean", "default": false, "description": "%numberedBookmarks.configuration.showBookmarkNotDefinedWarning.description%" }, "numberedBookmarks.navigateThroughAllFiles": { "type": "string", "default": "false", "description": "%numberedBookmarks.configuration.navigateThroughAllFiles.description%", "enum": [ "false", "replace", "allowDuplicates" ] }, "numberedBookmarks.gutterIconFillColor": { "type": "string", "default": "#00ff25", "description": "%numberedBookmarks.configuration.gutterIconFillColor.description%" }, "numberedBookmarks.gutterIconNumberColor": { "type": "string", "default": "#000", "description": "%numberedBookmarks.configuration.gutterIconNumberColor.description%" }, "numberedBookmarks.revealLocation": { "type": "string", "default": "center", "description": "%numberedBookmarks.configuration.revealLocation.description%", "enum": [ "top", "center" ], "enumDescriptions": [ "%numberedBookmarks.configuration.revealLocation.enumDescriptions.top%", "%numberedBookmarks.configuration.revealLocation.enumDescriptions.center%" ] } } }, "keybindings": [ { "command": "numberedBookmarks.toggleBookmark1", "key": "ctrl+shift+1", "mac": "cmd+shift+1", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark2", "key": "ctrl+shift+2", "mac": "cmd+shift+2", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark3", "key": "ctrl+shift+3", "mac": "cmd+shift+3", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark4", "key": "ctrl+shift+4", "mac": "cmd+shift+4", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark5", "key": "ctrl+shift+5", "mac": "cmd+shift+5", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark6", "key": "ctrl+shift+6", "mac": "cmd+shift+6", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark7", "key": "ctrl+shift+7", "mac": "cmd+shift+7", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark8", "key": "ctrl+shift+8", "mac": "cmd+shift+8", "when": "editorTextFocus" }, { "command": "numberedBookmarks.toggleBookmark9", "key": "ctrl+shift+9", "mac": "cmd+shift+9", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark1", "key": "ctrl+1", "mac": "cmd+1", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark2", "key": "ctrl+2", "mac": "cmd+2", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark3", "key": "ctrl+3", "mac": "cmd+3", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark4", "key": "ctrl+4", "mac": "cmd+4", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark5", "key": "ctrl+5", "mac": "cmd+5", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark6", "key": "ctrl+6", "mac": "cmd+6", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark7", "key": "ctrl+7", "mac": "cmd+7", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark8", "key": "ctrl+8", "mac": "cmd+8", "when": "editorTextFocus" }, { "command": "numberedBookmarks.jumpToBookmark9", "key": "ctrl+9", "mac": "cmd+9", "when": "editorTextFocus" } ], "colors": [ { "id": "numberedBookmarks.lineBackground", "description": "%numberedBookmarks.colors.lineBackground.description%", "defaults": { "dark": "#00000000", "light": "#00000000", "highContrast": "#00000000" } }, { "id": "numberedBookmarks.lineBorder", "description": "%numberedBookmarks.colors.lineBorder.description%", "defaults": { "dark": "#00000000", "light": "#00000000", "highContrast": "#00000000" } }, { "id": "numberedBookmarks.overviewRuler", "description": "%numberedBookmarks.colors.overviewRuler.description%", "defaults": { "dark": "#12ff1288", "light": "#12ff1288", "highContrast": "#12ff1288" } } ], "menus": { "commandPalette": [ { "command": "numberedBookmarks.whatsNewContextMenu", "when": "false" } ], "extension/context": [ { "command": "numberedBookmarks.whatsNewContextMenu", "group": "numberedBookmarks", "when": "extension == alefragnani.numbered-bookmarks && extensionStatus==installed" } ], "editor/context": [ { "submenu": "numberedBookmarks.context.toggle", "group": "numberedBookmarks@1" }, { "submenu": "numberedBookmarks.context.jump", "group": "numberedBookmarks@2" } ], "numberedBookmarks.context.toggle": [ { "command": "numberedBookmarks.toggleBookmark1", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark2", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark3", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark4", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark5", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark6", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark7", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark8", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark9", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.toggleBookmark0", "group": "numberedBookmarks@10" } ], "numberedBookmarks.context.jump": [ { "command": "numberedBookmarks.jumpToBookmark1", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark2", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark3", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark4", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark5", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark6", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark7", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark8", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark9", "group": "numberedBookmarks" }, { "command": "numberedBookmarks.jumpToBookmark0", "group": "numberedBookmarks@10" } ] }, "walkthroughs": [ { "id": "numberedBookmarksWelcome", "title": "%numberedBookmarks.walkthroughs.title%", "description": "%numberedBookmarks.walkthroughs.description%", "steps": [ { "id": "toggle", "title": "%numberedBookmarks.walkthroughs.toggle.title%", "description": "%numberedBookmarks.walkthroughs.toggle.description%", "media": { "markdown": "walkthrough/toggle.md" } }, { "id": "navigateToNumberedBookmarks", "title": "%numberedBookmarks.walkthroughs.navigateToNumberedBookmarks.title%", "description": "%numberedBookmarks.walkthroughs.navigateToNumberedBookmarks.description%", "media": { "markdown": "walkthrough/navigateToNumberedBookmarks.md" } }, { "id": "inspiredInDelphiButOpenToOthers", "title": "%numberedBookmarks.walkthroughs.inspiredInDelphiButOpenToOthers.title%", "description": "%numberedBookmarks.walkthroughs.inspiredInDelphiButOpenToOthers.description%", "media": { "markdown": "walkthrough/inspiredInDelphiButOpenToOthers.md" } }, { "id": "workingWithRemotes", "title": "%numberedBookmarks.walkthroughs.workingWithRemotes.title%", "description": "%numberedBookmarks.walkthroughs.workingWithRemotes.description%", "media": { "markdown": "walkthrough/workingWithRemotes.md" } }, { "id": "customizingAppearance", "title": "%numberedBookmarks.walkthroughs.customizingAppearance.title%", "description": "%numberedBookmarks.walkthroughs.customizingAppearance.description%", "media": { "markdown": "walkthrough/customizingAppearance.md" } } ] } ] }, "eslintConfig": { "extends": [ "vscode-ext" ] }, "scripts": { "build": "webpack --mode development", "watch": "webpack --watch --mode development", "vscode:prepublish": "webpack --mode production", "webpack": "webpack --mode development", "webpack-dev": "webpack --mode development --watch", "compile": "tsc -p ./", "lint": "eslint -c package.json --ext .ts src vscode-whats-new", "pretest": "npm run compile && npm run lint", "test-compile": "tsc -p ./ && npm run webpack", "just-test": "node ./out/src/test/runTest.js", "test": "npm run test-compile && npm run just-test" }, "dependencies": { "os-browserify": "^0.3.0", "path-browserify": "^1.0.1", "vscode-ext-codicons": "^1.1.0", "vscode-ext-decoration": "1.1.0" }, "devDependencies": { "@types/glob": "^8.1.0", "@types/mocha": "^10.0.0", "@types/node": "^18.17.0", "@types/vscode": "^1.73.0", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", "@vscode/test-electron": "^2.5.2", "eslint": "^8.1.0", "eslint-config-vscode-ext": "^1.1.0", "mocha": "^11.1.0", "terser-webpack-plugin": "^5.2.4", "ts-loader": "^9.2.5", "typescript": "^5.3.3", "webpack": "^5.105.0", "webpack-cli": "^4.8.0" } } ================================================ FILE: package.nls.json ================================================ { "numberedBookmarks.commands.toggleBookmark0.title": "Toggle Bookmark 0", "numberedBookmarks.commands.toggleBookmark1.title": "Toggle Bookmark 1", "numberedBookmarks.commands.toggleBookmark2.title": "Toggle Bookmark 2", "numberedBookmarks.commands.toggleBookmark3.title": "Toggle Bookmark 3", "numberedBookmarks.commands.toggleBookmark4.title": "Toggle Bookmark 4", "numberedBookmarks.commands.toggleBookmark5.title": "Toggle Bookmark 5", "numberedBookmarks.commands.toggleBookmark6.title": "Toggle Bookmark 6", "numberedBookmarks.commands.toggleBookmark7.title": "Toggle Bookmark 7", "numberedBookmarks.commands.toggleBookmark8.title": "Toggle Bookmark 8", "numberedBookmarks.commands.toggleBookmark9.title": "Toggle Bookmark 9", "numberedBookmarks.commands.jumpToBookmark0.title": "Jump to Bookmark 0", "numberedBookmarks.commands.jumpToBookmark1.title": "Jump to Bookmark 1", "numberedBookmarks.commands.jumpToBookmark2.title": "Jump to Bookmark 2", "numberedBookmarks.commands.jumpToBookmark3.title": "Jump to Bookmark 3", "numberedBookmarks.commands.jumpToBookmark4.title": "Jump to Bookmark 4", "numberedBookmarks.commands.jumpToBookmark5.title": "Jump to Bookmark 5", "numberedBookmarks.commands.jumpToBookmark6.title": "Jump to Bookmark 6", "numberedBookmarks.commands.jumpToBookmark7.title": "Jump to Bookmark 7", "numberedBookmarks.commands.jumpToBookmark8.title": "Jump to Bookmark 8", "numberedBookmarks.commands.jumpToBookmark9.title": "Jump to Bookmark 9", "numberedBookmarks.commands.list.title": "List", "numberedBookmarks.commands.listFromAllFiles.title": "List from All Files", "numberedBookmarks.commands.clear.title": "Clear", "numberedBookmarks.commands.clearFromAllFiles.title": "Clear from All Files", "numberedBookmarks.commands.whatsNew.title": "What's New", "numberedBookmarks.commands.whatsNewContextMenu.title": "What's New", "numberedBookmarks.context.toggle.label": "Numbered Bookmarks: Toggle", "numberedBookmarks.context.jump.label": "Numbered Bookmarks: Jump", "numberedBookmarks.configuration.title": "Numbered Bookmarks", "numberedBookmarks.configuration.saveBookmarksInProject.description": "Allow bookmarks to be saved (and restored) locally in the opened Project/Folder instead of VS Code", "numberedBookmarks.configuration.experimental.enableNewStickyEngine.description": "Experimental. Enables the new Sticky engine with support for Formatters, improved source change detections and undo operations", "numberedBookmarks.configuration.keepBookmarksOnLineDelete.description": "Specifies whether bookmarks on deleted line should be kept on file, moving it down to the next line, instead of deleting it with the line where it was toggled.", "numberedBookmarks.configuration.showBookmarkNotDefinedWarning.description": "Controls whether to show a warning when a bookmark is not defined", "numberedBookmarks.configuration.navigateThroughAllFiles.description": "Allow navigation look for bookmarks in all files in the project, instead of only the current", "numberedBookmarks.configuration.gutterIconFillColor.description": "Specify the color to use on gutter icon (fill color)", "numberedBookmarks.configuration.gutterIconNumberColor.description": "Specify the color to use on gutter icon (number color)", "numberedBookmarks.configuration.revealLocation.description": "Specifies the location where the bookmarked line will be revealed", "numberedBookmarks.configuration.revealLocation.enumDescriptions.top": "Reveals the bookmarked line at the top of the editor", "numberedBookmarks.configuration.revealLocation.enumDescriptions.center": "Reveals the bookmarked line in the center of the editor", "numberedBookmarks.colors.lineBackground.description": "Background color for the bookmarked line", "numberedBookmarks.colors.lineBorder.description": "Background color for the border around the bookmarked line", "numberedBookmarks.colors.overviewRuler.description": "Overview ruler marker color for bookmarks", "numberedBookmarks.walkthroughs.title": "Get Started with Numbered Bookmarks", "numberedBookmarks.walkthroughs.description": "Learn more about Numbered Bookmarks to optimize your workflow", "numberedBookmarks.walkthroughs.toggle.title": "Toggle Numbered Bookmarks", "numberedBookmarks.walkthroughs.toggle.description": "Easily Mark/Unmark Numbered Bookmarks at any position.\nAn icon is added to both the gutter and overview ruler to easily identify the lines with Numbered Bookmarks.", "numberedBookmarks.walkthroughs.navigateToNumberedBookmarks.title": "Navigate to Numbered Bookmarks", "numberedBookmarks.walkthroughs.navigateToNumberedBookmarks.description": "Quickly jump between bookmarked lines.\nSearch numbered bookmarks using the line's content and/or position.", "numberedBookmarks.walkthroughs.inspiredInDelphiButOpenToOthers.title": "Inspired in Delphi, but open to others", "numberedBookmarks.walkthroughs.inspiredInDelphiButOpenToOthers.description": "The extension was inspired in Delphi, because I was a Delphi developer for a long time, and love it's bookmarks, but it supports different editors as well.", "numberedBookmarks.walkthroughs.workingWithRemotes.title": "Working with Remotes", "numberedBookmarks.walkthroughs.workingWithRemotes.description": "The extension support [Remote Development](https://code.visualstudio.com/docs/remote/remote-overview) scenarios. Even installed locally, you can use Numbered Bookmarks in WSL, Containers, SSH and Codespaces.", "numberedBookmarks.walkthroughs.customizingAppearance.title": "Customizing Appearance", "numberedBookmarks.walkthroughs.customizingAppearance.description": "Customize how Numbered Bookmarks are presented, its icon, line and overview ruler\n[Open Settings - Gutter Icon](command:workbench.action.openSettings?%5B%22numberedBookmarks.gutterIcon%22%5D)\n[Open Settings - Line](command:workbench.action.openSettingsJson?%5B%22workbench.colorCustomizations%22%5D)" } ================================================ FILE: package.nls.pt-br.json ================================================ { "numberedBookmarks.commands.toggleBookmark0.title": "Alternar Bookmark 0", "numberedBookmarks.commands.toggleBookmark1.title": "Alternar Bookmark 1", "numberedBookmarks.commands.toggleBookmark2.title": "Alternar Bookmark 2", "numberedBookmarks.commands.toggleBookmark3.title": "Alternar Bookmark 3", "numberedBookmarks.commands.toggleBookmark4.title": "Alternar Bookmark 4", "numberedBookmarks.commands.toggleBookmark5.title": "Alternar Bookmark 5", "numberedBookmarks.commands.toggleBookmark6.title": "Alternar Bookmark 6", "numberedBookmarks.commands.toggleBookmark7.title": "Alternar Bookmark 7", "numberedBookmarks.commands.toggleBookmark8.title": "Alternar Bookmark 8", "numberedBookmarks.commands.toggleBookmark9.title": "Alternar Bookmark 9", "numberedBookmarks.commands.jumpToBookmark0.title": "Pular para Bookmark 0", "numberedBookmarks.commands.jumpToBookmark1.title": "Pular para Bookmark 1", "numberedBookmarks.commands.jumpToBookmark2.title": "Pular para Bookmark 2", "numberedBookmarks.commands.jumpToBookmark3.title": "Pular para Bookmark 3", "numberedBookmarks.commands.jumpToBookmark4.title": "Pular para Bookmark 4", "numberedBookmarks.commands.jumpToBookmark5.title": "Pular para Bookmark 5", "numberedBookmarks.commands.jumpToBookmark6.title": "Pular para Bookmark 6", "numberedBookmarks.commands.jumpToBookmark7.title": "Pular para Bookmark 7", "numberedBookmarks.commands.jumpToBookmark8.title": "Pular para Bookmark 8", "numberedBookmarks.commands.jumpToBookmark9.title": "Pular para Bookmark 9", "numberedBookmarks.commands.list.title": "Listar", "numberedBookmarks.commands.listFromAllFiles.title": "Listar de Todos os Arquivos", "numberedBookmarks.commands.clear.title": "Limpar", "numberedBookmarks.commands.clearFromAllFiles.title": "Limpar de Todos os Arquivos", "numberedBookmarks.commands.whatsNew.title": "Novidades", "numberedBookmarks.commands.whatsNewContextMenu.title": "Novidades", "numberedBookmarks.context.toggle.label": "Numbered Bookmarks: Alternar", "numberedBookmarks.context.jump.label": "Numbered Bookmarks: Pular", "numberedBookmarks.configuration.title": "Numbered Bookmarks", "numberedBookmarks.configuration.saveBookmarksInProject.description": "Permite que os Bookmarks sejam salvos (e restaurados) localmente no Projeto/Pasta aberto ao invés do VS Code", "numberedBookmarks.configuration.experimental.enableNewStickyEngine.description": "Experimental. Ativa o novo motor Sticky engine com suporte a Formatadores, detecção de mudança de fonte e operações de desfazer melhoradas", "numberedBookmarks.configuration.keepBookmarksOnLineDelete.description": "Determina se bookmarks em linhas excluídas devem ser mantidos no arquivo, movendo-os para a próxima linha, ao invés de excluídos com a linha onde se encontravam", "numberedBookmarks.configuration.showBookmarkNotDefinedWarning.description": "Define se uma notificação deve ser apresentada quando o Bookmark não está definido.", "numberedBookmarks.configuration.navigateThroughAllFiles.description": "Permite que a navegação apresente Bookmarks em todos os arquivos do projeto, ao invés de apenas no arquivo corrente", "numberedBookmarks.configuration.gutterIconFillColor.description": "Cor de fundo do ícone de Bookmark", "numberedBookmarks.configuration.gutterIconNumberColor.description": "Cor do número no ícone de Bookmark", "numberedBookmarks.configuration.revealLocation.description": "Especifica o local onde a linha com bookmark será exibida", "numberedBookmarks.configuration.revealLocation.enumDescriptions.top": "Exibe a linha com bookmark no topo do editor", "numberedBookmarks.configuration.revealLocation.enumDescriptions.center": "Exibe a linha com bookmark no centro do editor", "numberedBookmarks.colors.lineBackground.description": "Cor de fundo para linha com Bookmark", "numberedBookmarks.colors.lineBorder.description": "Cor de fundo da borda ao redor da linha com Bookmark", "numberedBookmarks.colors.overviewRuler.description": "Cor do marcador de régua com Bookmarks" } ================================================ FILE: src/core/bookmark.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { QuickPickItem, Uri } from "vscode"; export interface Bookmark { line: number; column: number; } export interface BookmarkQuickPickItem extends QuickPickItem { uri: Uri; } ================================================ FILE: src/core/constants.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ export const MAX_BOOKMARKS = 10; export const NO_BOOKMARK_DEFINED = { line: -1, column: 0 } export const UNTITLED_SCHEME = "untitled"; export const DEFAULT_GUTTER_ICON_FILL_COLOR = "#00ff25"; export const DEFAULT_GUTTER_ICON_NUMBER_COLOR = "#000"; ================================================ FILE: src/core/container.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ExtensionContext } from "vscode"; export class Container { private static _extContext: ExtensionContext; public static get context(): ExtensionContext { return this._extContext; } public static set context(ec: ExtensionContext) { this._extContext = ec; } } ================================================ FILE: src/core/controller.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import os = require("os"); import path = require("path"); import { Uri, WorkspaceFolder } from "vscode"; import { File } from "./file"; import { getFileUri, getRelativePath } from "../utils/fs"; import { createFile } from "./file"; import { isBookmarkDefined } from "./operations"; import { UNTITLED_SCHEME } from "./constants"; export class Controller { public files: File[]; public workspaceFolder: WorkspaceFolder | undefined; constructor(workspaceFolder: WorkspaceFolder | undefined) { this.workspaceFolder = workspaceFolder; this.files = []; } public loadFrom(jsonObject, relativePath?) { if (jsonObject === "") { return; } // OLD format if ((jsonObject.bookmarks)) { const jsonBookmarks = jsonObject.bookmarks; // tslint:disable-next-line: prefer-for-of for (let idx = 0; idx < jsonBookmarks.length; idx++) { const jsonBookmark = jsonBookmarks[ idx ]; // untitled files, ignore (for now) const ff = jsonBookmark.fsPath; if (ff.match(/Untitled-\d+/)) { continue; } const file = relativePath ? createFile(jsonBookmark.fsPath.replace(`$ROOTPATH$${path.sep}`, "")) : createFile(getRelativePath(this.workspaceFolder?.uri?.fsPath, jsonBookmark.fsPath)); // Win32 uses `\\` but uris always uses `/` if (os.platform() === "win32") { file.path = file.path.replace(/\\/g, "/"); } const bmksPosition = jsonBookmark.bookmarks.map(bmk => { return {line: bmk, column: 0} }); file.bookmarks = [ ...bmksPosition ] this.files.push(file); } } else { // NEW format for (const file of jsonObject.files) { const bookmark = createFile(file.path);//??, file.uri ? file.uri : undefined); bookmark.bookmarks = [ ...file.bookmarks ] this.files.push(bookmark); } } } public fromUri(uri: Uri) { if (uri.scheme === UNTITLED_SCHEME) { for (const file of this.files) { if (file.uri?.toString() === uri.toString()) { return file; } } return; } const uriPath = !this.workspaceFolder ? uri.path : getRelativePath(this.workspaceFolder.uri.path, uri.path); for (const file of this.files) { if (file.path === uriPath) { return file; } } } public indexFromPath(filePath: string) { for (let index = 0; index < this.files.length; index++) { const file = this.files[index]; if (file.path === filePath) { return index; } } } public addFile(uri: Uri) { if (uri.scheme === UNTITLED_SCHEME) { // let foundFile: File; // for (const file of this.files) { // if (file.uri?.toString() === uri.toString()) { // foundFile = file; // } // } // if (!foundFile) { const file = createFile(uri.path, uri); this.files.push(file); // } return; } const uriPath = !this.workspaceFolder ? uri.path : getRelativePath(this.workspaceFolder.uri.path, uri.path); const paths = this.files.map(file => file.path); if (paths.indexOf(uriPath) < 0) { const bookmark = createFile(uriPath); this.files.push(bookmark); } } public getFileUri(file: File) { return getFileUri(file, this.workspaceFolder); } public zip(): Controller { function isNotEmpty(book: File): boolean { let hasAny = false; for (const element of book.bookmarks) { hasAny = isBookmarkDefined(element); if (hasAny) { break; } } return hasAny; } function isValid(file: File): boolean { return !file.uri ; // Untitled files } function canBeSaved(file: File): boolean { return isValid(file) && isNotEmpty(file); } const newBookmarks: Controller = new Controller(this.workspaceFolder); newBookmarks.files = JSON.parse(JSON.stringify(this.files)).filter(canBeSaved); delete newBookmarks.workspaceFolder; return newBookmarks; } public updateFilePath(oldFilePath: string, newFilePath: string): void { for (const file of this.files) { if (file.path === oldFilePath) { file.path = newFilePath; break; } } } public updateDirectoryPath(oldDirectoryPath: string, newDirectoryPath: string): void { for (const file of this.files) { if (file.path.startsWith(oldDirectoryPath)) { file.path = file.path.replace(oldDirectoryPath, newDirectoryPath); } } } } ================================================ FILE: src/core/file.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Uri } from "vscode"; import { Bookmark } from "./bookmark"; import { MAX_BOOKMARKS } from "./constants"; import { clearBookmarks } from "./operations"; export interface File { path: string; bookmarks: Bookmark[]; uri?: Uri; } export function createFile(filePath: string, uri?: Uri): File { const newFile: File = { path: filePath, bookmarks: [], uri } newFile.bookmarks.length = MAX_BOOKMARKS; clearBookmarks(newFile); return newFile; } ================================================ FILE: src/core/operations.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Uri, workspace, WorkspaceFolder } from "vscode"; import { Bookmark, BookmarkQuickPickItem } from "./bookmark"; import { MAX_BOOKMARKS, NO_BOOKMARK_DEFINED } from "./constants"; import { uriExists } from "../utils/fs"; import { File } from "./file"; export function isBookmarkDefined(bookmark: Bookmark): boolean { return bookmark.line !== NO_BOOKMARK_DEFINED.line; } export function hasBookmarks(file: File): boolean { let hasAny = false; for (const element of file.bookmarks) { hasAny = isBookmarkDefined(element); if (hasAny) { break; } } return hasAny; } export function listBookmarks(file: File, workspaceFolder: WorkspaceFolder) { // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { if (!hasBookmarks(file)) { resolve({}); return; } let uriDocBookmark: Uri; if (file.uri) { uriDocBookmark = file.uri; } else { if (!workspaceFolder) { uriDocBookmark = Uri.file(file.path); } else { const prefix = workspaceFolder.uri.path.endsWith("/") ? workspaceFolder.uri.path : `${workspaceFolder.uri.path}/`; uriDocBookmark = workspaceFolder.uri.with({ path: `${prefix}/${file.path}` }); } } if (! await uriExists(uriDocBookmark)) { resolve({}); return; } workspace.openTextDocument(uriDocBookmark).then(doc => { const items: BookmarkQuickPickItem[] = []; const invalids = []; for (const element of file.bookmarks) { // fix for modified files if (isBookmarkDefined(element)) { if (element.line <= doc.lineCount) { const bookmarkLine = element.line + 1; const bookmarkColumn = element.column + 1; const lineText = doc.lineAt(bookmarkLine - 1).text.trim(); items.push({ label: lineText, description: "(Ln " + bookmarkLine.toString() + ", Col " + bookmarkColumn.toString() + ")", detail: file.path, uri: uriDocBookmark }); } else { invalids.push(element); } } } if (invalids.length > 0) { // tslint:disable-next-line:prefer-for-of for (let indexI = 0; indexI < invalids.length; indexI++) { file.bookmarks[ invalids[ indexI ] ] = NO_BOOKMARK_DEFINED; } } resolve(items); return; }); }); } export function clearBookmarks(file: File) { for (let index = 0; index < MAX_BOOKMARKS; index++) { file.bookmarks[ index ] = NO_BOOKMARK_DEFINED; } } export function indexOfBookmark(file: File, line: number): number { for (let index = 0; index < file.bookmarks.length; index++) { const bookmark = file.bookmarks[index]; if (bookmark.line === line) { return index; } } return -1; } ================================================ FILE: src/decoration/decoration.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { DecorationRenderOptions, OverviewRulerLane, Range, TextEditor, TextEditorDecorationType, ThemeColor, Uri, workspace, window } from "vscode"; import { createLineDecoration } from "vscode-ext-decoration"; import { DEFAULT_GUTTER_ICON_NUMBER_COLOR, DEFAULT_GUTTER_ICON_FILL_COLOR, MAX_BOOKMARKS, NO_BOOKMARK_DEFINED } from "../core/constants"; import { File } from "../core/file"; import { clearBookmarks } from "../core/operations"; function createGutterRulerDecoration( overviewRulerLane?: OverviewRulerLane, overviewRulerColor?: string | ThemeColor, gutterIconPath?: string | Uri): TextEditorDecorationType { const decorationOptions: DecorationRenderOptions = { gutterIconPath, overviewRulerLane, overviewRulerColor }; decorationOptions.isWholeLine = false; return window.createTextEditorDecorationType(decorationOptions); } export interface TextEditorDecorationTypePair { gutterDecoration: TextEditorDecorationType; lineDecoration: TextEditorDecorationType; } export function createBookmarkDecorations(): TextEditorDecorationTypePair[] { const decorators: TextEditorDecorationTypePair[] = []; for (let number = 0; number <= 9; number++) { const iconFillColor = workspace.getConfiguration("numberedBookmarks").get("gutterIconFillColor", DEFAULT_GUTTER_ICON_FILL_COLOR); const iconNumberColor = workspace.getConfiguration("numberedBookmarks").get("gutterIconNumberColor", DEFAULT_GUTTER_ICON_NUMBER_COLOR); const iconPath = Uri.parse( `data:image/svg+xml,${encodeURIComponent( ` ${number} `, )}`, ); const overviewRulerColor = new ThemeColor('numberedBookmarks.overviewRuler'); const lineBackground = new ThemeColor('numberedBookmarks.lineBackground'); const lineBorder = new ThemeColor('numberedBookmarks.lineBorder'); const gutterDecoration = createGutterRulerDecoration(OverviewRulerLane.Full, overviewRulerColor, iconPath); const lineDecoration = createLineDecoration(lineBackground, lineBorder); decorators.push( { gutterDecoration, lineDecoration }); } return decorators; } export function updateDecorationsInActiveEditor(activeEditor: TextEditor, activeBookmark: File, getDecorationPair: (n: number) => TextEditorDecorationTypePair) { if (!activeEditor) { return; } if (!activeBookmark) { return; } let books: Range[] = []; // Remove all bookmarks if active file is empty if (activeEditor.document.lineCount === 1 && activeEditor.document.lineAt(0).text === "") { clearBookmarks(activeBookmark); } else { const invalids = []; for (let index = 0; index < MAX_BOOKMARKS; index++) { books = []; if (activeBookmark.bookmarks[ index ].line < 0) { const decors = getDecorationPair(index); activeEditor.setDecorations(decors.gutterDecoration, books); activeEditor.setDecorations(decors.lineDecoration, books); } else { const element = activeBookmark.bookmarks[ index ]; if (element.line < activeEditor.document.lineCount) { const decoration = new Range(element.line, 0, element.line, 0); books.push(decoration); const decors = getDecorationPair(index); activeEditor.setDecorations(decors.gutterDecoration, books); activeEditor.setDecorations(decors.lineDecoration, books); } else { invalids.push(index); } } } if (invalids.length > 0) { // tslint:disable-next-line:prefer-for-of for (let indexI = 0; indexI < invalids.length; indexI++) { activeBookmark.bookmarks[ invalids[ indexI ] ] = NO_BOOKMARK_DEFINED; } } } } ================================================ FILE: src/extension.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from "vscode"; import { l10n, Position, TextDocument, Uri } from "vscode"; import { Bookmark, BookmarkQuickPickItem } from "./core/bookmark"; import { NO_BOOKMARK_DEFINED } from "./core/constants"; import { Controller } from "./core/controller"; import { clearBookmarks, hasBookmarks, indexOfBookmark, isBookmarkDefined, listBookmarks } from "./core/operations"; import { revealPosition, previewPositionInDocument, revealPositionInDocument } from "./utils/reveal"; import { Sticky } from "./sticky/stickyLegacy"; import { loadBookmarks, saveBookmarks } from "./storage/workspaceState"; import { Container } from "./core/container"; import { registerWhatsNew } from "./whats-new/commands"; import { codicons } from "vscode-ext-codicons"; import { appendPath, getRelativePath, parsePosition } from "./utils/fs"; import { File } from "./core/file"; import { updateDecorationsInActiveEditor, createBookmarkDecorations, TextEditorDecorationTypePair } from "./decoration/decoration"; import { pickController } from "./quickpick/controllerPicker"; import { updateStickyBookmarks } from "./sticky/sticky"; export async function activate(context: vscode.ExtensionContext) { Container.context = context; await registerWhatsNew(); let activeController: Controller; let controllers: Controller[] = []; let activeEditorCountLine: number; let timeout = null; let activeEditor = vscode.window.activeTextEditor; let activeFile: File; let bookmarkDecorationTypePairs = createBookmarkDecorations(); bookmarkDecorationTypePairs.forEach(decorator => { context.subscriptions.push(decorator.gutterDecoration); context.subscriptions.push(decorator.lineDecoration); }); // load pre-saved bookmarks await loadWorkspaceState(); // Connect it to the Editors Events if (activeEditor) { getActiveController(activeEditor.document); activeController.addFile(activeEditor.document.uri); activeEditorCountLine = activeEditor.document.lineCount; activeFile = activeController.fromUri(activeEditor.document.uri); triggerUpdateDecorations(); } // new docs // vscode.workspace.onDidOpenTextDocument(doc => { // // activeEditorCountLine = doc.lineCount; // getActiveController(doc); // activeController.addFile(doc.uri); // }); vscode.window.onDidChangeActiveTextEditor(editor => { activeEditor = editor; if (editor) { activeEditorCountLine = editor.document.lineCount; getActiveController(editor.document); activeController.addFile(editor.document.uri); activeFile = activeController.fromUri(editor.document.uri); triggerUpdateDecorations(); } }, null, context.subscriptions); vscode.workspace.onDidChangeTextDocument(event => { if (activeEditor && event.document === activeEditor.document) { let updatedBookmark = true; // call sticky function when the activeEditor is changed if (activeFile && activeFile.bookmarks.length > 0) { if (vscode.workspace.getConfiguration("numberedBookmarks").get("experimental.enableNewStickyEngine", true)) { updatedBookmark = updateStickyBookmarks(event, activeFile, activeEditor, activeController); } else { updatedBookmark = Sticky.stickyBookmarks(event, activeEditorCountLine, activeFile, activeEditor); } } activeEditorCountLine = event.document.lineCount; updateDecorations(); if (updatedBookmark) { saveWorkspaceState(); } } }, null, context.subscriptions); vscode.workspace.onDidChangeConfiguration(async event => { if (event.affectsConfiguration("numberedBookmarks.gutterIconFillColor") || event.affectsConfiguration("numberedBookmarks.gutterIconNumberColor") ) { if (bookmarkDecorationTypePairs.length > 0) { bookmarkDecorationTypePairs.forEach(decorator => { decorator.gutterDecoration.dispose(); decorator.lineDecoration.dispose(); }); } bookmarkDecorationTypePairs = createBookmarkDecorations(); bookmarkDecorationTypePairs.forEach(decorator => { context.subscriptions.push(decorator.gutterDecoration); context.subscriptions.push(decorator.lineDecoration); }); // context.subscriptions.push(...bookmarkDecorationTypePairs[0], ...bookmarkDecorationTypePairs[1]); } }, null, context.subscriptions); vscode.workspace.onDidRenameFiles(async rename => { if (rename.files.length === 0) { return; } for (const file of rename.files) { const files = activeController.files.map(file => file.path); const stat = await vscode.workspace.fs.stat(file.newUri); const fileRelativeOldPath = getRelativePath(activeController.workspaceFolder.uri.path, file.oldUri.path); const fileRelativeNewPath = getRelativePath(activeController.workspaceFolder.uri.path, file.newUri.path); if (stat.type === vscode.FileType.File) { if (files.includes(fileRelativeOldPath)) { activeController.updateFilePath(fileRelativeOldPath, fileRelativeNewPath); } } if (stat.type === vscode.FileType.Directory) { activeController.updateDirectoryPath(fileRelativeOldPath, fileRelativeNewPath); } } saveWorkspaceState(); if (activeEditor) { activeFile = activeController.fromUri(activeEditor.document.uri); updateDecorations(); } }, null, context.subscriptions); // Timeout function triggerUpdateDecorations() { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(updateDecorations, 100); } function getDecorationPair(n: number): TextEditorDecorationTypePair { return bookmarkDecorationTypePairs[ n ]; } // Evaluate (prepare the list) and DRAW function updateDecorations() { updateDecorationsInActiveEditor(activeEditor, activeFile, getDecorationPair); } // other commands for (let i = 0; i <= 9; i++) { vscode.commands.registerCommand( `numberedBookmarks.toggleBookmark${i}`, () => toggleBookmark(i, vscode.window.activeTextEditor.selection.active) ); vscode.commands.registerCommand( `numberedBookmarks.jumpToBookmark${i}`, () => jumpToBookmark(i) ); } vscode.commands.registerCommand("numberedBookmarks.clear", () => { clearBookmarks(activeFile); saveWorkspaceState(); updateDecorations(); }); vscode.commands.registerCommand("numberedBookmarks.clearFromAllFiles", async () => { const controller = await pickController(controllers, activeController); if (!controller) { return } for (const file of controller.files) { clearBookmarks(file); } saveWorkspaceState(); updateDecorations(); }); vscode.commands.registerCommand("numberedBookmarks.list", () => { // no bookmark if (!hasBookmarks(activeFile)) { vscode.window.showInformationMessage(l10n.t("No Bookmarks found")); return; } // push the items const items: vscode.QuickPickItem[] = []; for (const bookmark of activeFile.bookmarks) { if (isBookmarkDefined(bookmark)) { const bookmarkLine = bookmark.line + 1; const bookmarkColumn = bookmark.column + 1; const lineText = vscode.window.activeTextEditor.document.lineAt(bookmarkLine - 1).text.trim(); items.push({ label: lineText, description: "(Ln " + bookmarkLine.toString() + ", Col " + bookmarkColumn.toString() + ")" }); } } // pick one const currentPosition: Position = vscode.window.activeTextEditor.selection.active; const options = { placeHolder: l10n.t("Type a line number or a piece of code to navigate to"), matchOnDescription: true, matchOnDetail: true, onDidSelectItem: item => { const itemT = item; const point: Bookmark = parsePosition(itemT.description); if (point) { revealPosition(point.line - 1, point.column - 1); } } }; vscode.window.showQuickPick(items, options).then(selection => { if (typeof selection === "undefined") { revealPosition(currentPosition.line, currentPosition.character); return; } const itemT = selection; const point: Bookmark = parsePosition(itemT.description); if (point) { revealPosition(point.line - 1, point.column - 1); } }); }); vscode.commands.registerCommand("numberedBookmarks.listFromAllFiles", async () => { const controller = await pickController(controllers, activeController); if (!controller) { return } // no bookmark let someFileHasBookmark: boolean; for (const file of controller.files) { someFileHasBookmark = someFileHasBookmark || hasBookmarks(file); if (someFileHasBookmark) break; } if (!someFileHasBookmark) { vscode.window.showInformationMessage(l10n.t("No Bookmarks found")); return; } // push the items const items: BookmarkQuickPickItem[] = []; const activeTextEditor = vscode.window.activeTextEditor; const promisses = []; const currentPosition: Position = vscode.window.activeTextEditor?.selection.active; // tslint:disable-next-line:prefer-for-of for (let index = 0; index < controller.files.length; index++) { const file = controller.files[ index ]; const pp = listBookmarks(file, controller.workspaceFolder); promisses.push(pp); } Promise.all(promisses).then( (values) => { // tslint:disable-next-line:prefer-for-of for (let index = 0; index < values.length; index++) { const element = values[ index ]; // tslint:disable-next-line:prefer-for-of for (let indexInside = 0; indexInside < element.length; indexInside++) { const elementInside = element[ indexInside ]; if (activeTextEditor && elementInside.detail.toString().toLocaleLowerCase() === getRelativePath(controller.workspaceFolder?.uri?.path, activeTextEditor.document.uri.path).toLocaleLowerCase()) { items.push( { label: elementInside.label, description: elementInside.description, uri: elementInside.uri } ); } else { items.push( { label: elementInside.label, description: elementInside.description, detail: elementInside.detail, uri: elementInside.uri } ); } } } // sort // - active document // - no octicon - document inside project // - with octicon - document outside project const itemsSorted: BookmarkQuickPickItem[] = items.sort(function(a: BookmarkQuickPickItem, b: BookmarkQuickPickItem): number { if (!a.detail && !b.detail) { return 0; } if (!a.detail && b.detail) { return -1; } if (a.detail && !b.detail) { return 1; } if ((a.detail.toString().indexOf(codicons.file_submodule + " ") === 0) && (b.detail.toString().indexOf(codicons.file_directory + " ") === 0)) { return -1; } if ((a.detail.toString().indexOf(codicons.file_directory + " ") === 0) && (b.detail.toString().indexOf(codicons.file_submodule + " ") === 0)) { return 1; } if ((a.detail.toString().indexOf(codicons.file_submodule + " ") === 0) && (b.detail.toString().indexOf(codicons.file_submodule + " ") === -1)) { return 1; } if ((a.detail.toString().indexOf(codicons.file_submodule + " ") === -1) && (b.detail.toString().indexOf(codicons.file_submodule + " ") === 0)) { return -1; } if ((a.detail.toString().indexOf(codicons.file_directory + " ") === 0) && (b.detail.toString().indexOf(codicons.file_directory + " ") === -1)) { return 1; } if ((a.detail.toString().indexOf(codicons.file_directory + " ") === -1) && (b.detail.toString().indexOf(codicons.file_directory + " ") === 0)) { return -1; } return 0; }); const options = { placeHolder: l10n.t("Type a line number or a piece of code to navigate to"), matchOnDescription: true, onDidSelectItem: item => { const itemT = item let fileUri: Uri; if (!itemT.detail) { fileUri = activeTextEditor.document.uri; } else { fileUri = itemT.uri; } const point: Bookmark = parsePosition(itemT.description); if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.uri.fsPath.toLowerCase() === fileUri.fsPath.toLowerCase()) { revealPosition(point.line - 1, point.column - 1); } else { previewPositionInDocument(point, fileUri); } } }; vscode.window.showQuickPick(itemsSorted, options).then(async selection => { if (typeof selection === "undefined") { if (!activeTextEditor) { vscode.commands.executeCommand("workbench.action.closeActiveEditor"); return; } else { vscode.workspace.openTextDocument(activeTextEditor.document.uri).then(doc => { vscode.window.showTextDocument(doc).then(() => { revealPosition(currentPosition.line, currentPosition.character) return; }); }); } } if (typeof selection === "undefined") { return; } const point: Bookmark = parsePosition(selection.description); if (!selection.detail) { if (point) { revealPosition(point.line - 1, point.column - 1); } } }); } ); }); function getActiveController(document: TextDocument): void { // system files don't have workspace, so use the first one [0] if (!vscode.workspace.getWorkspaceFolder(document.uri)) { activeController = controllers[0]; return; } if (controllers.length > 1) { activeController = controllers.find(ctrl => ctrl.workspaceFolder.uri.path === vscode.workspace.getWorkspaceFolder(document.uri).uri.path); } } async function loadWorkspaceState(): Promise { // no workspace, load as `undefined` and will always be from `workspaceState` if (!vscode.workspace.workspaceFolders) { const ctrl = await loadBookmarks(undefined); controllers.push(ctrl); activeController = ctrl; return; } // NOT `saveBookmarksInProject` if (!vscode.workspace.getConfiguration("numberedBookmarks").get("saveBookmarksInProject", false)) { //if (vscode.workspace.workspaceFolders.length > 1) { // no matter how many workspaceFolders exists, will always load from [0] because even with // multi-root, there would be no way to load state from different folders const ctrl = await loadBookmarks(vscode.workspace.workspaceFolders[0]); controllers.push(ctrl); activeController = ctrl; return; } // `saveBookmarksInProject` TRUE // single or multi-root, will load from each `workspaceFolder` controllers = await Promise.all( vscode.workspace.workspaceFolders!.map(async workspaceFolder => { const ctrl = await loadBookmarks(workspaceFolder); return ctrl; }) ); if (controllers.length === 1) { activeController = controllers[0]; } } function saveWorkspaceState(): void { // no workspace, there is only one `controller`, and will always be from `workspaceState` if (!vscode.workspace.workspaceFolders) { saveBookmarks(activeController); return; } // NOT `saveBookmarksInProject`, will load from `workspaceFolders[0]` - as before if (!vscode.workspace.getConfiguration("numberedBookmarks").get("saveBookmarksInProject", false)) { // no matter how many workspaceFolders exists, will always save to [0] because even with // multi-root, there would be no way to save state to different folders saveBookmarks(activeController); return; } // `saveBookmarksInProject` TRUE // single or multi-root, will save to each `workspaceFolder` controllers.forEach(controller => { saveBookmarks(controller); }); } function toggleBookmark(n: number, position: vscode.Position) { // fix issue emptyAtLaunch if (!activeFile) { activeController.addFile(vscode.window.activeTextEditor.document.uri); activeFile = activeController.fromUri(vscode.window.activeTextEditor.document.uri); } // there is another bookmark already set for this line? const index: number = indexOfBookmark(activeFile, position.line); if (index >= 0) { clearBookmark(index); } // if was myself, then I want to 'remove' if (index !== n) { activeFile.bookmarks[ n ] = { line: position.line, column: position.character } // when _toggling_ only "replace" differs, because it has to _invalidate_ that bookmark from other files const navigateThroughAllFiles: string = vscode.workspace.getConfiguration("numberedBookmarks").get("navigateThroughAllFiles", "false"); if (navigateThroughAllFiles === "replace") { for (const element of activeController.files) { if (element.path !== activeFile.path) { element.bookmarks[ n ] = NO_BOOKMARK_DEFINED; } } } } saveWorkspaceState(); updateDecorations(); } function clearBookmark(n: number) { activeFile.bookmarks[ n ] = NO_BOOKMARK_DEFINED; } async function jumpToBookmark(n: number) { if (!activeFile) { return; } // when _jumping_ each config has its own behavior const navigateThroughAllFiles: string = vscode.workspace.getConfiguration("numberedBookmarks").get("navigateThroughAllFiles", "false"); switch (navigateThroughAllFiles) { case "replace": // is it already set? if (activeFile.bookmarks[ n ].line < 0) { // no, look for another document that contains that bookmark // I can start from the first because _there is only one_ for (const element of activeController.files) { if ((element.path !== activeFile.path) && (isBookmarkDefined(element.bookmarks[ n ]))) { await revealPositionInDocument(element.bookmarks[n], activeController.getFileUri(element)); return; } } } else { revealPosition(activeFile.bookmarks[ n ].line, activeFile.bookmarks[ n ].column); } break; case "allowDuplicates": { // this file has, and I'm not in the line if ((isBookmarkDefined(activeFile.bookmarks[ n ])) && (activeFile.bookmarks[ n ].line !== vscode.window.activeTextEditor.selection.active.line)) { revealPosition(activeFile.bookmarks[ n ].line, activeFile.bookmarks[ n ].column); break; } // no, look for another document that contains that bookmark // I CAN'T start from the first because _there can be duplicates_ const currentFile: number = activeController.indexFromPath(activeFile.path); let found = false; // to the end for (let index = currentFile; index < activeController.files.length; index++) { const element = activeController.files[ index ]; if ((!found) && (element.path !== activeFile.path) && (isBookmarkDefined(element.bookmarks[ n ]))) { found = true; const uriDocument = appendPath(activeController.workspaceFolder.uri, element.path); await revealPositionInDocument(element.bookmarks[n], uriDocument); return; } } if (!found) { for (let index = 0; index < currentFile; index++) { const element = activeController.files[ index ]; if ((!found) && (element.path !== activeFile.path) && (isBookmarkDefined(element.bookmarks[ n ]))) { found = true; const uriDocument = appendPath(activeController.workspaceFolder.uri, element.path); await revealPositionInDocument(element.bookmarks[n], uriDocument); return; } } if (!found) { if (vscode.workspace.getConfiguration("numberedBookmarks").get("showBookmarkNotDefinedWarning", false)) { vscode.window.showWarningMessage(l10n.t("The Bookmark {0} is not defined", n)); } return; } } break; } default: // "false" // is it already set? if (activeFile.bookmarks.length === 0) { vscode.window.showInformationMessage(l10n.t("No Bookmarks found")); return; } if (activeFile.bookmarks[ n ].line < 0) { if (vscode.workspace.getConfiguration("numberedBookmarks").get("showBookmarkNotDefinedWarning", false)) { vscode.window.showWarningMessage(l10n.t("The Bookmark {0} is not defined", n)); } return; } revealPosition(activeFile.bookmarks[ n ].line, activeFile.bookmarks[ n ].column); break; } } } ================================================ FILE: src/quickpick/controllerPicker.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import path = require("path"); import { l10n, QuickPickItem, window } from "vscode"; import { codicons } from "vscode-ext-codicons"; import { Controller } from "../core/controller"; interface ControllerQuickPickItem extends QuickPickItem { controller: Controller; } export async function pickController(controllers: Controller[], activeController: Controller): Promise { if (controllers.length === 1) { return activeController; } const items: ControllerQuickPickItem[] = controllers.map(controller => { return { label: codicons.root_folder + ' ' + controller.workspaceFolder.name, description: path.dirname(controller.workspaceFolder.uri.path), controller: controller } } ); const selection = await window.showQuickPick(items, { placeHolder: l10n.t('Select a workspace') }); if (typeof selection === "undefined") { return undefined } return selection.controller; } ================================================ FILE: src/sticky/sticky.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Castellant Guillaume & Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. * * Original Author: Castellant Guillaume (@Terminux), * (https://github.com/alefragnani/vscode-bookmarks/pull/20) *--------------------------------------------------------------------------------------------*/ import * as vscode from "vscode"; import { NO_BOOKMARK_DEFINED } from "../core/constants"; import { Controller } from "../core/controller"; import { File } from "../core/file"; import { indexOfBookmark } from "../core/operations"; export function updateStickyBookmarks(event: vscode.TextDocumentChangeEvent, activeBookmark: File, activeEditor: vscode.TextEditor, controller: Controller): boolean { // no changes at all if (hasNoChanges(event)) { return false; } // added an empty, indented, line if (isAddEmptyLineWithIndent(event, activeBookmark, activeEditor, controller)) { return true; } // just a Move Line UP / Down if (isMoveLineUpDown(event, activeBookmark, activeEditor, controller)) { return true; } let updatedBookmark = false; const keepBookmarksOnLineDelete = vscode.workspace.getConfiguration("numberedBookmarks").get("keepBookmarksOnLineDelete", false); // the NEW Sticky Engine for (const contentChangeEvent of event.contentChanges) { // didn't DEL neither ADD lines if (!isDeleteLine(contentChangeEvent) && !isAddLine(contentChangeEvent)) { continue; } if (isAddLine(contentChangeEvent)) { const numberOfLinesAdded = (contentChangeEvent.text.match(/\n/g) || []).length; for (let index = 0; index < activeBookmark.bookmarks.length; index++) { const eventLine: number = contentChangeEvent.range.start.line; let eventcharacter: number = contentChangeEvent.range.start.character; // indent ? if (eventcharacter > 0) { let textInEventLine = activeEditor.document.lineAt(eventLine).text; textInEventLine = textInEventLine.replace(/\t/g, "").replace(/\s/g, ""); if (textInEventLine === "") { eventcharacter = 0; } } // also = if ( ((activeBookmark.bookmarks[ index ].line > eventLine) && (eventcharacter > 0)) || ((activeBookmark.bookmarks[ index ].line >= eventLine) && (eventcharacter === 0)) ) { const newLine = activeBookmark.bookmarks[ index ].line + numberOfLinesAdded; activeBookmark.bookmarks[index].line = newLine; updatedBookmark = true; } } } if (isDeleteLine(contentChangeEvent)) { // delete bookmarks INSIDE the deleted content for (let i = contentChangeEvent.range.start.line; i < contentChangeEvent.range.end.line; i++) { const index = indexOfBookmark(activeBookmark, i); if (index > -1) { if (keepBookmarksOnLineDelete) { const hasBookmarkAfterDeletionBlock = indexOfBookmark(activeBookmark, contentChangeEvent.range.end.line) > -1; if (!hasBookmarkAfterDeletionBlock) { const newLine = contentChangeEvent.range.end.line; activeBookmark.bookmarks[index].line = newLine; } else { activeBookmark.bookmarks[index] = NO_BOOKMARK_DEFINED; } } else { activeBookmark.bookmarks[index] = NO_BOOKMARK_DEFINED; } updatedBookmark = true; } } // move bookmarks UP const numberOfLinesDeleted = contentChangeEvent.range.end.line - contentChangeEvent.range.start.line; for (let index = 0; index < activeBookmark.bookmarks.length; index++) { // const element = activeBookmark.bookmarks[index]; const eventLine: number = contentChangeEvent.range.start.line; let eventcharacter: number = contentChangeEvent.range.start.character; // indent ? if (eventcharacter > 0) { let textInEventLine = activeEditor.document.lineAt(eventLine).text; textInEventLine = textInEventLine.replace(/\t/g, "").replace(/\s/g, ""); if (textInEventLine === "") { eventcharacter = 0; } } if ( ((activeBookmark.bookmarks[ index ].line > eventLine) && (eventcharacter > 0)) || ((activeBookmark.bookmarks[ index ].line >= eventLine) && (eventcharacter === 0)) ) { const newLine = activeBookmark.bookmarks[ index ].line - numberOfLinesDeleted; activeBookmark.bookmarks[index].line = newLine; updatedBookmark = true; } } } } return updatedBookmark; } function isAddLine(contentChangeEvent: vscode.TextDocumentContentChangeEvent) { return contentChangeEvent.text.includes("\n"); } function isDeleteLine(contentChangeEvent: vscode.TextDocumentContentChangeEvent) { return /* contentChangeEvent.text === "" && */(contentChangeEvent.range.start.line < contentChangeEvent.range.end.line); } function hasNoChanges(event: vscode.TextDocumentChangeEvent) { return event.contentChanges.length === 0; } function isAddEmptyLineWithIndent(event: vscode.TextDocumentChangeEvent, activeBookmark: File, activeEditor: vscode.TextEditor, controller: Controller) { if (event.contentChanges.length !== 2) { return false; } const firstEvent = event.contentChanges[0]; const firstEventIsExpectation = (firstEvent.range.start.line === firstEvent.range.end.line && firstEvent.range.start.character === firstEvent.range.end.character && firstEvent.text.match(/\n/g).length > 0) const secondEvent = event.contentChanges[1]; const secondEventIsExpectation = (secondEvent.range.start.line === secondEvent.range.end.line && secondEvent.range.start.character === 0 && secondEvent.range.end.character !== 0 && secondEvent.text === ""); if (firstEventIsExpectation && secondEventIsExpectation) { return moveStickyBookmarks("up", secondEvent.range, activeBookmark, controller); } else { return false; } } function isMoveLineUpDown(event: vscode.TextDocumentChangeEvent, activeBookmark: File, activeEditor: vscode.TextEditor, controller: Controller) { // move line up and move line down const moveChanges = event.contentChanges.filter(c => !(c.range.start.line === c.range.end.line && /^[\t ]*$/.test(c.text))); if (moveChanges.length === 2) { let updatedBookmark = false; // move line up and move line down case if (activeEditor.selections.length === 1) { if (moveChanges[ 0 ].text === "") { updatedBookmark = moveStickyBookmarks("down", moveChanges[ 1 ].range, activeBookmark, controller); } else if (moveChanges[ 1 ].text === "") { updatedBookmark = moveStickyBookmarks("up", moveChanges[ 0 ].range, activeBookmark, controller); } } return updatedBookmark; } // not that stable yet // if (event.contentChanges.length > 1 && moveChanges.length === 1) { // let updatedBookmark = false; // if (activeEditor.selections.length === 1) { // if (moveChanges[ 0 ].range.start.line === activeEditor.selections[0].start.line) { // updatedBookmark = moveStickyBookmarks("up", moveChanges[ 0 ].range, activeBookmark, activeEditor, controller); // } else { // updatedBookmark = moveStickyBookmarks("down", moveChanges[ 0 ].range, activeBookmark, activeEditor, controller); // } // } // return updatedBookmark; // } return false; } function moveStickyBookmarks(direction: string, range: vscode.Range, activeBookmark: File, controller: Controller): boolean { let diffChange = -1; let updatedBookmark = false; let diffLine; const selection = range;//activeEditor.selection; let lineRange = [ selection.start.line, selection.end.line ]; const lineMin = Math.min.apply(this, lineRange); let lineMax = Math.max.apply(this, lineRange); if (selection.end.character === 0 && !selection.isSingleLine) { // const lineAt = activeEditor.document.lineAt(selection.end.line); // const posMin = new vscode.Position(selection.start.line + 1, selection.start.character); // const posMax = new vscode.Position(selection.end.line, lineAt.range.end.character); // vscode.window.activeTextEditor.selection = new vscode.Selection(posMin, posMax); lineMax--; } let indexRemoved: number; if (direction === "up") { diffLine = 1; indexRemoved = indexOfBookmark(activeBookmark, lineMin - 1); if (indexRemoved > -1) { diffChange = lineMax; activeBookmark.bookmarks[ indexRemoved ] = NO_BOOKMARK_DEFINED; updatedBookmark = true; } } else if (direction === "down") { diffLine = -1; indexRemoved = indexOfBookmark(activeBookmark, lineMax + 1); if (indexRemoved > -1) { diffChange = lineMin; activeBookmark.bookmarks[ indexRemoved ] = NO_BOOKMARK_DEFINED; updatedBookmark = true; } } lineRange = []; for (let i = lineMin; i <= lineMax; i++) { lineRange.push(i); } lineRange = lineRange.sort(); if (diffLine < 0) { lineRange = lineRange.reverse(); } // tslint:disable-next-line: forin for (const i in lineRange) { const index = indexOfBookmark(activeBookmark, lineRange[ i ]); if (index > -1) { activeBookmark.bookmarks[ index ].line -= diffLine; updatedBookmark = true; } } if (diffChange > -1 && indexRemoved) { activeBookmark.bookmarks[ indexRemoved ] = {line: diffChange, column: 0}; updatedBookmark = true; } return updatedBookmark; } ================================================ FILE: src/sticky/stickyLegacy.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Castellant Guillaume & Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. * * Original Author: Castellant Guillaume (@Terminux), * (https://github.com/alefragnani/vscode-bookmarks/pull/20) *--------------------------------------------------------------------------------------------*/ import * as vscode from "vscode"; import { File } from "../core/file"; import { NO_BOOKMARK_DEFINED } from "../core/constants"; import { indexOfBookmark } from "../core/operations"; export class Sticky { public static stickyBookmarks(event: vscode.TextDocumentChangeEvent, activeEditorCountLine: number, activeBookmark: File, activeEditor: vscode.TextEditor): boolean { let diffLine: number; let updatedBookmark = false; // fix autoTrimWhitespace // if (event.contentChanges.length === 1) { if (this.hadOnlyOneValidContentChange(event)) { // add or delete line case if (event.document.lineCount !== activeEditorCountLine) { if (event.document.lineCount > activeEditorCountLine) { diffLine = event.document.lineCount - activeEditorCountLine; } else if (event.document.lineCount < activeEditorCountLine) { diffLine = activeEditorCountLine - event.document.lineCount; diffLine = 0 - diffLine; // one line up if (event.contentChanges[ 0 ].range.end.line - event.contentChanges[ 0 ].range.start.line === 1) { if ((event.contentChanges[ 0 ].range.end.character === 0) && (event.contentChanges[ 0 ].range.start.character === 0)) { // the bookmarked one const idxbk = indexOfBookmark(activeBookmark, event.contentChanges[ 0 ].range.start.line); // const idxbk = activeBookmark.bookmarks.indexOf(event.contentChanges[ 0 ].range.start.line); if (idxbk > -1) { activeBookmark.bookmarks[ idxbk ] = NO_BOOKMARK_DEFINED; } } } if (event.contentChanges[ 0 ].range.end.line - event.contentChanges[ 0 ].range.start.line > 1) { for (let i = event.contentChanges[ 0 ].range.start.line/* + 1*/; i <= event.contentChanges[ 0 ].range.end.line; i++) { const index = indexOfBookmark(activeBookmark, i); // const index = activeBookmark.bookmarks.indexOf(i); if (index > -1) { activeBookmark.bookmarks[ index ] = NO_BOOKMARK_DEFINED; updatedBookmark = true; } } } } // for (let index in activeBookmark.bookmarks) { for (let index = 0; index < activeBookmark.bookmarks.length; index++) { const eventLine = event.contentChanges[ 0 ].range.start.line; let eventcharacter = event.contentChanges[ 0 ].range.start.character; // indent ? if (eventcharacter > 0) { let textInEventLine = activeEditor.document.lineAt(eventLine).text; textInEventLine = textInEventLine.replace(/\t/g, "").replace(/\s/g, ""); if (textInEventLine === "") { eventcharacter = 0; } } // also = if ( ((activeBookmark.bookmarks[ index ].line > eventLine) && (eventcharacter > 0)) || ((activeBookmark.bookmarks[ index ].line >= eventLine) && (eventcharacter === 0)) ) { let newLine = activeBookmark.bookmarks[ index ].line + diffLine; if (newLine < 0) { newLine = 0; } activeBookmark.bookmarks[ index ].line = newLine; updatedBookmark = true; } } } // paste case if (!updatedBookmark && (event.contentChanges[ 0 ].text.length > 1)) { const selection = vscode.window.activeTextEditor.selection; const lineRange = [ selection.start.line, selection.end.line ]; let lineMin = Math.min.apply(this, lineRange); let lineMax = Math.max.apply(this, lineRange); if (selection.start.character > 0) { lineMin++; } if (selection.end.character < vscode.window.activeTextEditor.document.lineAt(selection.end).range.end.character) { lineMax--; } if (lineMin <= lineMax) { for (let i = lineMin; i <= lineMax; i++) { const index = activeBookmark.bookmarks.indexOf(i); if (index > -1) { activeBookmark.bookmarks[ index ] = NO_BOOKMARK_DEFINED; updatedBookmark = true; } } } } } else if (event.contentChanges.length === 2) { // move line up and move line down case if (activeEditor.selections.length === 1) { if (event.contentChanges[ 0 ].text === "") { updatedBookmark = this.moveStickyBookmarks("down", activeBookmark, activeEditor); } else if (event.contentChanges[ 1 ].text === "") { updatedBookmark = this.moveStickyBookmarks("up", activeBookmark, activeEditor); } } } return updatedBookmark; } private static moveStickyBookmarks(direction: string, activeBookmark: File, activeEditor: vscode.TextEditor): boolean { let diffChange = -1; let updatedBookmark = false; let diffLine; const selection = activeEditor.selection; let lineRange = [ selection.start.line, selection.end.line ]; const lineMin = Math.min.apply(this, lineRange); let lineMax = Math.max.apply(this, lineRange); if (selection.end.character === 0 && !selection.isSingleLine) { // const lineAt = activeEditor.document.lineAt(selection.end.line); // const posMin = new vscode.Position(selection.start.line + 1, selection.start.character); // const posMax = new vscode.Position(selection.end.line, lineAt.range.end.character); // vscode.window.activeTextEditor.selection = new vscode.Selection(posMin, posMax); lineMax--; } if (direction === "up") { diffLine = 1; const index = indexOfBookmark(activeBookmark, lineMin - 1); // const index = activeBookmark.bookmarks.indexOf(lineMin - 1); if (index > -1) { diffChange = lineMax; activeBookmark.bookmarks[ index ] = NO_BOOKMARK_DEFINED; updatedBookmark = true; } } else if (direction === "down") { diffLine = -1; const index = activeBookmark.bookmarks.indexOf(lineMax + 1); if (index > -1) { diffChange = lineMin; activeBookmark.bookmarks[ index ] = NO_BOOKMARK_DEFINED; updatedBookmark = true; } } lineRange = []; for (let i = lineMin; i <= lineMax; i++) { lineRange.push(i); } lineRange = lineRange.sort(); if (diffLine < 0) { lineRange = lineRange.reverse(); } // tslint:disable-next-line: forin for (const i in lineRange) { const index = indexOfBookmark(activeBookmark, lineRange[ i ]); // const index = activeBookmark.bookmarks.indexOf(lineRange[ i ]); if (index > -1) { activeBookmark.bookmarks[ index ].line -= diffLine; updatedBookmark = true; } } if (diffChange > -1) { //?? activeBookmark.bookmarks.push(diffChange); activeBookmark.bookmarks.push({line: diffChange, column: 0}); updatedBookmark = true; } return updatedBookmark; } private static hadOnlyOneValidContentChange(event: vscode.TextDocumentChangeEvent): boolean { // not valid if ((event.contentChanges.length > 2) || (event.contentChanges.length === 0)) { return false; } // normal behavior - only 1 if (event.contentChanges.length === 1) { return true; } else { // has 2, but is it a trimAutoWhitespace issue? if (event.contentChanges.length === 2) { const trimAutoWhitespace: boolean = vscode.workspace.getConfiguration("editor").get("trimAutoWhitespace", true); if (!trimAutoWhitespace) { return false; } // check if the first range is 'equal' and if the second is 'empty' let fistRangeEquals: boolean = (event.contentChanges[ 0 ].range.start.character === event.contentChanges[ 0 ].range.end.character) && (event.contentChanges[ 0 ].range.start.line === event.contentChanges[ 0 ].range.end.line); let secondRangeEmpty: boolean = (event.contentChanges[ 1 ].text === "") && (event.contentChanges[ 1 ].range.start.line === event.contentChanges[ 1 ].range.end.line) && (event.contentChanges[ 1 ].range.start.character === 0) && (event.contentChanges[ 1 ].range.end.character > 0); if (fistRangeEquals && secondRangeEmpty) { return true; } else { fistRangeEquals = (event.contentChanges[ 0 ].rangeLength > 0) && (event.contentChanges[ 0 ].text === ""); secondRangeEmpty = (event.contentChanges[ 1 ].rangeLength === 0) && (event.contentChanges[ 1 ].text === "\r\n"); return fistRangeEquals && secondRangeEmpty; } } } } } ================================================ FILE: src/storage/workspaceState.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { workspace, window, WorkspaceFolder, l10n } from "vscode"; import { Container } from "../core/container"; import { Controller } from "../core/controller"; import { appendPath, createDirectoryUri, readFileUri, uriExists, writeFileUri } from "../utils/fs"; export function canSaveBookmarksInProject(): boolean { let saveBookmarksInProject: boolean = workspace.getConfiguration("numberedBookmarks").get("saveBookmarksInProject", false); // really use saveBookmarksInProject // 0. has at least a folder opened // 1. is a valid workspace/folder // 2. has only one workspaceFolder // let hasBookmarksFile: boolean = false; if (saveBookmarksInProject && !workspace.workspaceFolders) { saveBookmarksInProject = false; } return saveBookmarksInProject; } export async function loadBookmarks(workspaceFolder: WorkspaceFolder): Promise { const saveBookmarksInProject: boolean = canSaveBookmarksInProject(); const newController = new Controller(workspaceFolder); if (saveBookmarksInProject) { const bookmarksFileInProject = appendPath(appendPath(workspaceFolder.uri, ".vscode"), "numbered-bookmarks.json"); if (! await uriExists(bookmarksFileInProject)) { return newController; } try { const contents = await readFileUri(bookmarksFileInProject); newController.loadFrom(contents, true); return newController; } catch (error) { window.showErrorMessage(l10n.t("Error loading Numbered Bookmarks: {0}", error.toString())); return newController; } } else { const savedBookmarks = Container.context.workspaceState.get("numberedBookmarks", ""); if (savedBookmarks !== "") { newController.loadFrom(JSON.parse(savedBookmarks)); } return newController; } } export function saveBookmarks(controller: Controller): void { const saveBookmarksInProject: boolean = canSaveBookmarksInProject(); if (saveBookmarksInProject) { const bookmarksFileInProject = appendPath(appendPath(controller.workspaceFolder.uri, ".vscode"), "numbered-bookmarks.json"); if (!uriExists(appendPath(controller.workspaceFolder.uri, ".vscode"))) { createDirectoryUri(appendPath(controller.workspaceFolder.uri, ".vscode")); } writeFileUri(bookmarksFileInProject, JSON.stringify(controller.zip(), null, "\t")); } else { Container.context.workspaceState.update("numberedBookmarks", JSON.stringify(controller.zip())); } } ================================================ FILE: src/test/runTest.ts ================================================ import * as path from 'path'; import { runTests } from '@vscode/test-electron'; async function main() { try { // The folder containing the Extension Manifest package.json // Passed to `--extensionDevelopmentPath` const extensionDevelopmentPath = path.resolve(__dirname, '../../../'); // The path to test runner // Passed to --extensionTestsPath const extensionTestsPath = path.resolve(__dirname, './suite/index'); // Download VS Code, unzip it and run the integration test await runTests({ extensionDevelopmentPath, extensionTestsPath }); } catch (err) { console.error(err); console.error('Failed to run tests'); process.exit(1); } } main(); ================================================ FILE: src/test/suite/extension.test.ts ================================================ import * as assert from 'assert'; // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; const timeout = async (ms = 200) => new Promise(resolve => setTimeout(resolve, ms)); suite('Extension Test Suite', () => { let extension: vscode.Extension; vscode.window.showInformationMessage('Start all tests.'); suiteSetup(() => { extension = vscode.extensions.getExtension('alefragnani.numbered-bookmarks') as vscode.Extension; }); test('Sample test', () => { assert.equal(-1, [1, 2, 3].indexOf(5)); assert.equal(-1, [1, 2, 3].indexOf(0)); }); test('Activation test', async () => { await extension.activate(); assert.equal(extension.isActive, true); }); test('Extension loads in VSCode and is active', async () => { await timeout(1500); assert.equal(extension.isActive, true); }); }); ================================================ FILE: src/test/suite/index.ts ================================================ import * as path from 'path'; import * as Mocha from 'mocha'; import * as glob from 'glob'; export function run(): Promise { // Create the mocha test const mocha = new Mocha({ ui: 'tdd', color: true }); const testsRoot = path.resolve(__dirname, '..'); return new Promise((c, e) => { glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { if (err) { return e(err); } // Add files to the test suite files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); try { // Run the mocha test mocha.run(failures => { if (failures > 0) { e(new Error(`${failures} tests failed.`)); } else { c(); } }); } catch (err) { console.error(err); e(err); } }); }); } ================================================ FILE: src/utils/fs.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import os = require("os"); import path = require("path"); import { Uri, workspace, WorkspaceFolder } from "vscode"; import { Bookmark } from "../core/bookmark"; import { UNTITLED_SCHEME } from "../core/constants"; import { File } from "../core/file"; export function getRelativePath(folder: string, filePath: string) { if (!folder) { return filePath; } let relativePath = path.relative(folder, filePath); // multiplatform if (os.platform() === "win32") { relativePath = relativePath.replace(/\\/g, "/"); } return relativePath; } export function appendPath(uri: Uri, pathSuffix: string): Uri { const pathPrefix = uri.path.endsWith("/") ? uri.path : `${uri.path}/`; const filePath = `${pathPrefix}${pathSuffix}`; return uri.with({ path: filePath }); } export function uriJoin(uri: Uri, ...paths: string[]): string { return path.join(uri.fsPath, ...paths); } export function uriWith(uri: Uri, prefix: string, filePath: string): Uri { const newPrefix = prefix === "/" ? "" : prefix; return uri.with({ path: `${newPrefix}/${filePath}` }); } export async function uriExists(uri: Uri): Promise { if (uri.scheme === UNTITLED_SCHEME) { return true; } try { await workspace.fs.stat(uri); return true; } catch { return false; } } export async function uriDelete(uri: Uri): Promise { if (uri.scheme === UNTITLED_SCHEME) { return true; } try { await workspace.fs.delete(uri); return true; } catch { return false; } } export async function fileExists(filePath: string): Promise { try { await workspace.fs.stat(Uri.parse(filePath)); return true; } catch { return false; } } export async function createDirectoryUri(uri: Uri): Promise { return workspace.fs.createDirectory(uri); } export async function createDirectory(dir: string): Promise { return workspace.fs.createDirectory(Uri.parse(dir)); } export async function readFile(filePath: string): Promise { const bytes = await workspace.fs.readFile(Uri.parse(filePath)); return JSON.parse(new TextDecoder('utf-8').decode(bytes)); } export async function readFileUri(uri: Uri): Promise { const bytes = await workspace.fs.readFile(uri); return JSON.parse(new TextDecoder('utf-8').decode(bytes)); } export async function readRAWFileUri(uri: Uri): Promise { const bytes = await workspace.fs.readFile(uri); return new TextDecoder('utf-8').decode(bytes); } export async function writeFile(filePath: string, contents: string): Promise { const writeData = new TextEncoder().encode(contents); await workspace.fs.writeFile(Uri.parse(filePath), writeData); } export async function writeFileUri(uri: Uri, contents: string): Promise { const writeData = new TextEncoder().encode(contents); await workspace.fs.writeFile(uri, writeData); } export function parsePosition(position: string): Bookmark | undefined { const re = new RegExp(/\(Ln\s(\d+),\sCol\s(\d+)\)/); const matches = re.exec(position); if (matches) { return { line: parseInt(matches[ 1 ], 10), column: parseInt(matches[ 2 ], 10) }; } return undefined; } export function getFileUri(file: File, workspaceFolder: WorkspaceFolder): Uri { if (file.uri) { return file.uri; } if (!workspaceFolder) { return Uri.file(file.path); } const prefix = workspaceFolder.uri.path.endsWith("/") ? workspaceFolder.uri.path : `${workspaceFolder.uri.path}/`; return uriWith(workspaceFolder.uri, prefix, file.path); } ================================================ FILE: src/utils/reveal.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Selection, Tab, TabInputText, TextEditorRevealType, Uri, ViewColumn, window, workspace } from "vscode"; import { Bookmark } from "../core/bookmark"; import { getRevealLocationConfig } from "./revealLocation"; export function revealLine(line: number, directJump?: boolean) { const newSe = new Selection(line, 0, line, 0); window.activeTextEditor.selection = newSe; window.activeTextEditor.revealRange(newSe, getRevealLocationConfig(directJump)); } export function revealPosition(line: number, column: number): void { if (isNaN(column)) { revealLine(line); } else { const revealType: TextEditorRevealType = getRevealLocationConfig(line === window.activeTextEditor.selection.active.line); const newPosition = new Selection(line, column, line, column); window.activeTextEditor.selection = newPosition; window.activeTextEditor.revealRange(newPosition, revealType); } } export async function previewPositionInDocument(point: Bookmark, uri: Uri): Promise { const textDocument = await workspace.openTextDocument(uri); await window.showTextDocument(textDocument, { preserveFocus: true, preview: true } ); revealPosition(point.line - 1, point.column - 1); } export async function revealPositionInDocument(point: Bookmark, uri: Uri): Promise { const tabGroupColumn = findTabGroupColumn(uri, window.activeTextEditor.viewColumn); const textDocument = await workspace.openTextDocument(uri); await window.showTextDocument(textDocument, tabGroupColumn, false); revealPosition(point.line, point.column); } function findTabGroupColumn(uri: Uri, column: ViewColumn): ViewColumn { if (window.tabGroups.all.length === 1) { return column; } for (const tab of window.tabGroups.activeTabGroup.tabs) { if (isTabOfUri(tab, uri)) { return tab.group.viewColumn; } } for (const tabGroup of window.tabGroups.all) { if (tabGroup.viewColumn === column) continue; for (const tab of tabGroup.tabs) { if (isTabOfUri(tab, uri)) { return tab.group.viewColumn; } } } return column; } function isTabOfUri(tab: Tab, uri: Uri): boolean { return tab.input instanceof TabInputText && tab.input.uri.fsPath.toLocaleLowerCase() === uri.fsPath.toLocaleLowerCase() } ================================================ FILE: src/utils/revealLocation.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { TextEditorRevealType, workspace } from "vscode"; export enum RevealLocation { Top = "top", Center = "center" } export function getRevealLocationConfig(ifOutsideViewport: boolean): TextEditorRevealType { const configuration = workspace.getConfiguration("numberedBookmarks"); const revealLocation = configuration.get("revealLocation", RevealLocation.Center); return revealLocation === RevealLocation.Top ? TextEditorRevealType.AtTop : ifOutsideViewport ? TextEditorRevealType.InCenterIfOutsideViewport : TextEditorRevealType.InCenter; } ================================================ FILE: src/whats-new/commands.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { commands } from "vscode"; import { Container } from "../core/container"; import { WhatsNewManager } from "../../vscode-whats-new/src/Manager"; import { NumberedBookmarksContentProvider, NumberedBookmarksSocialMediaProvider } from "./contentProvider"; export async function registerWhatsNew() { const provider = new NumberedBookmarksContentProvider(); const viewer = new WhatsNewManager(Container.context) .registerContentProvider("alefragnani", "numbered-bookmarks", provider) .registerSocialMediaProvider(new NumberedBookmarksSocialMediaProvider()); await viewer.showPageInActivation(); Container.context.subscriptions.push(commands.registerCommand("numberedBookmarks.whatsNew", () => viewer.showPage())); Container.context.subscriptions.push(commands.registerCommand("numberedBookmarks.whatsNewContextMenu", () => viewer.showPage())); } ================================================ FILE: src/whats-new/contentProvider.ts ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the GPLv3 License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ChangeLogItem, ChangeLogKind, ContentProvider, Header, Image, Sponsor, IssueKind, SupportChannel, SocialMediaProvider } from "../../vscode-whats-new/src/ContentProvider"; export class NumberedBookmarksContentProvider implements ContentProvider { public provideHeader(logoUrl: string): Header { return
{logo: {src: logoUrl, height: 50, width: 50}, message: `Numbered Bookmarks helps you to navigate in your code, moving between important positions easily and quickly. No more need to search for code. All of this in Delphi style`}; } public provideChangeLog(): ChangeLogItem[] { const changeLog: ChangeLogItem[] = []; changeLog.push({ kind: ChangeLogKind.VERSION, detail: { releaseNumber: "9.0.0", releaseDate: "November 2025" } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "Fully Open Source again", id: 131, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.FIXED, detail: { message: "Reuse opened file", id: 180, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Security Alert: word-wrap", id: 167, kind: IssueKind.PR, kudos: "dependabot" } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Security Alert: webpack", id: 178, kind: IssueKind.PR, kudos: "dependabot" } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Security Alert: serialize-javascript", id: 183, kind: IssueKind.PR, kudos: "dependabot" } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Security Alert: braces", id: 176, kind: IssueKind.PR, kudos: "dependabot" } }); changeLog.push({ kind: ChangeLogKind.VERSION, detail: { releaseNumber: "8.5.0", releaseDate: "March 2024" } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "Published to Open VSX", id: 147, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "New setting to choose viewport position on navigation", id: 141, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.VERSION, detail: { releaseNumber: "8.4.0", releaseDate: "June 2023" } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "Add Getting Started/Walkthrough support", id: 117, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "Add Localization (l10n) support", id: 151, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.CHANGED, detail: { message: "Avoid What's New when using Gitpod", id: 168, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.CHANGED, detail: { message: "Avoid What's New when installing lower versions", id: 168, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.FIXED, detail: { message: "Repeated gutter icon on line wrap", id: 149, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Improve Startup speed", id: 145, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Security Alert: webpack", id: 156, kind: IssueKind.PR, kudos: "dependabot" } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: { message: "Security Alert: terser", id: 143, kind: IssueKind.PR, kudos: "dependabot" } }); changeLog.push({ kind: ChangeLogKind.VERSION, detail: { releaseNumber: "8.3.1", releaseDate: "June 2022" } }); changeLog.push({ kind: ChangeLogKind.INTERNAL, detail: "Add GitHub Sponsors support" }); changeLog.push({ kind: ChangeLogKind.VERSION, detail: { releaseNumber: "8.3.0", releaseDate: "April 2022" } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "New setting to decide if should delete bookmark if associated line is deleted", id: 27, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.NEW, detail: { message: "Update bookmark reference on file renames", id: 120, kind: IssueKind.Issue } }); changeLog.push({ kind: ChangeLogKind.CHANGED, detail: { message: "Replace custom icons with on the fly approach", id: 129, kind: IssueKind.Issue } }); return changeLog; } public provideSupportChannels(): SupportChannel[] { const supportChannels: SupportChannel[] = []; supportChannels.push({ title: "Become a sponsor on GitHub", link: "https://github.com/sponsors/alefragnani", message: "Become a Sponsor" }); supportChannels.push({ title: "Donate via PayPal", link: "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EP57F3B6FXKTU&lc=US&item_name=Alessandro%20Fragnani&item_number=vscode%20extensions¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted", message: "Donate via PayPal" }); return supportChannels; } } export class NumberedBookmarksSocialMediaProvider implements SocialMediaProvider { public provideSocialMedias() { return [{ title: "Follow me on Twitter", link: "https://www.twitter.com/alefragnani" }]; } } ================================================ FILE: tsconfig.json ================================================ { "compilerOptions": { "module": "commonjs", "target": "ES2020", "outDir": "out", "lib": [ "ES2020", "DOM" ], "sourceMap": true, "rootDir": ".", "alwaysStrict": true }, "exclude": [ "node_modules", ".vscode-test" ] } ================================================ FILE: walkthrough/customizingAppearance.md ================================================ ## Customizing Appearance You can customize not only how the icon is show in the Gutter, but also add a background color to the bookmarked line and the overview ruller. Something like this in your settings: ```json "numberedBookmarks.gutterIconFillColor": "#00FF0077", // "numberedBookmarks.gutterIconNumberColor": "157EFB", "workbench.colorCustomizations": { ... "numberedBookmarks.lineBackground": "#0077ff2a", "numberedBookmarks.lineBorder": "#FF0000", "numberedBookmarks.overviewRuler": "#157EFB88" } ``` Could end up with a numbered bookmark like this: ![Customized Numbered Bookmark](customizedNumberedBookmark.png) ================================================ FILE: walkthrough/customizingAppearance.nls.pt-br.md ================================================ ## Personalizando a Aparência Você pode personalizar não apenas como o ícone é apresentado na Medianiz, mas também adicionar cor de fundo a linha com bookmark e a régua de visão geral. Algo como isso nas suas configuráções: ```json "numberedBookmarks.gutterIconFillColor": "#00FF0077", // "numberedBookmarks.gutterIconNumberColor": "157EFB", "workbench.colorCustomizations": { ... "numberedBookmarks.lineBackground": "#0077ff2a", "numberedBookmarks.lineBorder": "#FF0000", "numberedBookmarks.overviewRuler": "#157EFB88" } ``` Pode deixar seus bookmarks assim: ![Numbered Bookmark Personalizado](customizedNumberedBookmark.png) ================================================ FILE: walkthrough/inspiredInDelphiButOpenToOthers.md ================================================ ## Inpired in Delphi, but open to others The extension was inspired in Delphi, because I was a Delphi developer for a long time, and love it's bookmarks. But it supports different editors as well. To change a bit how the extension works (toggling and navigation), simply play with the `numberedBookmarks.navigateThroughAllFiles` setting: Value | Explanation --------- | --------- `false` | _default_ - same behavior as today `replace` | you can't have the same numbered bookmark in different files `allowDuplicates` | you can have the same numbered bookmark in different files, and if you jump repeatedly to the same number, it will look on other files. ### IntelliJ / UltraEdit developers If you are an **IntelliJ** or **UltraEdit** user, you will notice the numbered bookmarks works a bit different from the default behavior. To make **Numbered Bookmarks** works the same way as these other tools, simply add `"numberedBookmarks.navigateThroughAllFiles": replace"` to your setting and you are good to go.
Open Settings
================================================ FILE: walkthrough/inspiredInDelphiButOpenToOthers.nls.pt-br.md ================================================ ## Inspirado no Delphi, mas aberto a outros A extensão foi inspirada no Delphi, pois eu fui um desenvolvedor Delphi por muito tempo, e adoro seus bookmarks. Mas ele suporta diferentes editores também. Para mudar um pouco como a extensão funciona (alternar e navegar), basta brincar com a configuração `numberedBookmarks.navigateThroughAllFiles`: Valor | Explicação --------- | --------- `false` | _padrão_ - mesmo comportamento de hoje `replace` | você não pode ter o mesmo numbered bookmark em arquivos distintos `allowDuplicates` | você pode ter o mesmo numbered bookmark em arquivos distintos, e se você acionar repetidamente ao mesmo número, ele irá olhar para os outros arquivos. ### Desenvolvedores IntelliJ / UltraEdit Se você é um usuário do **IntelliJ** ou **UltraEdit**, você vai notar que o numbered bookmarks funciona um pouco diferente do seu comportamento padrão. Para fazer **Numbered Bookmarks** funcionar do mesmo jeito dessas ferramentas, simplesmente adicione `"numberedBookmarks.navigateThroughAllFiles": replace"` nas suas configurações e aproveite.
Abrir Configurações
================================================ FILE: walkthrough/navigateToNumberedBookmarks.md ================================================ ## Navigate to Numbered Bookmarks Bookmarks represent positions in your code, so you can easily and quickly go back to them whenever necessary. The extension provides commands to quickly navigate every bookmark, from `Numbered Bookmarks: Jump to Bookmark 0` to `Numbered Bookmarks: Jump to Bookmark 9`, with a keyboard shortcut for each one of it (Ctrl + #number) But it is not limited to this. It also provides commands to see all Numbered Bookmarks within a file, or the entire workspace and easily go to it. Use the `Numbered Bookmarks: List` and `Numbered Bookmarks: List from All Files` command instead, and the extension will display a preview of the bookmarked line and it position. ![List](../images/numbered-bookmarks-list-from-all-files.gif) > Tip: If you simply navigate on the list, the editor will temporarily scroll to its position, giving you a better understanding if that bookmark is what you were looking for. ================================================ FILE: walkthrough/navigateToNumberedBookmarks.nls.pt-br.md ================================================ ## Navegar para Numbered Bookmarks Bookmarks representam posições no seu código, então você pode voltar a elas de forma rápida e fácil sempre que necessário. Essa extensão disponibiliza comandos para nevegar facilmente para cada numbered bookmark, de `Numbered Bookmarks: Pular para Bookmark 0` até `Numbered Bookmarks: Pular para Bookmark 9`, com uma tecla de atalho para cada um (Ctrl + #number) Mas não está limitado a isso. Também disponibiliza comandos para visualizar todos os Numbered Bookmarks em um arquivo, ou em toda a área de trabalho. Use os comandos `Numbered Bookmarks: Listar` and `Numbered Bookmarks: Listar de Todos os Arquivos`, e a extensão apresentará uma prévia da linha com bookmark e sua posição. ![Lista](../images/numbered-bookmarks-list-from-all-files.gif) > Dica: Se você simplesmente navegar pela lista, o editor irá rolar temporariamente para a posição do bookmark, dando-lhe um entendimento melhor se o bookmark é aquele que você está procurando. ================================================ FILE: walkthrough/toggle.md ================================================ ## Toggle Numbered Bookmarks You can easily Mark/Unmark Numbered Bookmarks on any position. ![Toggle](../images/numbered-bookmarks-toggle.png) > Tip: Use Keyboard Shortcut Ctrl + Shift + #number ================================================ FILE: walkthrough/toggle.nls.pt-br.md ================================================ ## Anternar Numbered Bookmarks Você pode adicionar/remover Numbered Bookmarks facilmente em qualquer posição. ![Alternar](../images/numbered-bookmarks-toggle.png) > Dica: Use o Atalho de Teclado Ctrl + Shift + #number ================================================ FILE: walkthrough/workingWithRemotes.md ================================================ ## Working with Remotes The extension fully supports [Remote Development](https://code.visualstudio.com/docs/remote/remote-overview) scenarios. It means that when you connect to a _remote_ location, like a Docker Container, SSH or WSL, the extension will be available, ready to be used. > You don't need to install the extension on the remote. Better yet, if you use `numberedBookmarks.saveBookmarksInProject` setting defined as `true`, the bookmarks saved locally _will be available_ remotely, and you will be able to navigate and update the bookmarks. Just like it was a resource from folder you opened remotely. ================================================ FILE: walkthrough/workingWithRemotes.nls.pt-br.md ================================================ ## Trabalhando com Remotos A extensão suporta completamente cenários de [Desenvolvimento Remoto](https://code.visualstudio.com/docs/remote/remote-overview). Isso significa que quando você conecta a um local _remoto_, como Container Docker, SSH ou WSL, a extensão estará disponível, pronta para ser usada. > Você não precisa instalar a extensão no ambiente remoto. Melhor ainda, se você usar a configuração `numberedBookmarks.saveBookmarksInProject` definida como `true`, os bookmarks salvos localmente _estarão disponíveis_ remotamente, e você conseguirá navegar e atualizar os bookmarks. Assim como se fosse um recurso de uma pasta que você abriu remotamente. ================================================ FILE: webpack.config.js ================================================ /*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the GPLv3 License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ //@ts-check 'use strict'; const path = require('path'); const TerserPlugin = require('terser-webpack-plugin'); const webpack = require('webpack'); /**@type {import('webpack').Configuration}*/ const config = { entry: "./src/extension.ts", optimization: { minimizer: [new TerserPlugin({ parallel: true, terserOptions: { ecma: 2019, keep_classnames: false, mangle: true, module: true } })], }, devtool: 'source-map', externals: { vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ }, resolve: { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader extensions: ['.ts', '.js'] }, module: { rules: [{ test: /\.ts$/, exclude: /node_modules/, use: [{ loader: 'ts-loader', }] }] }, }; const nodeConfig = { ...config, target: "node", output: { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ path: path.resolve(__dirname, 'dist'), filename: 'extension-node.js', libraryTarget: "commonjs2", devtoolModuleFilenameTemplate: "../[resource-path]", }, } module.exports = [nodeConfig];