Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document .scope format #2815

Open
AndreasArvidsson opened this issue Feb 4, 2025 · 0 comments · May be fixed by #2818
Open

Document .scope format #2815

AndreasArvidsson opened this issue Feb 4, 2025 · 0 comments · May be fixed by #2818
Assignees

Comments

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Feb 4, 2025

Example

Example of .scope file for the javascript if statement scope.

if (true) {

}
---

[Content] =
[Removal] =
[Domain] = 0:0-2:1
  >-----------
0| if (true) {
1|
2| }
   -<

[Insertion delimiter] = "\n"

Understanding the format

General layout of a .scope file is:

Source code
---
Scopes

Source code

The code that you want to generate scopes for. We try to keep this as short and simple as possible while still containing the syntax you want to test.

Scopes

One or more scopes found in the source code. Each scope is a collection of ranges as well as an insertion delimiter.

A description of the different ranges and how they are used is available in our glossary.

Scope ranges

The below example indicates that the content range, removal range, and domain range was the same. Line 0, column 0, to line 2, column 1. These ranges could also be different and in that case each show up as a separate range.

[Content] =
[Removal] =
[Domain] = 0:0-2:1

Each range is also visualized:

  >-----------
0| if (true) {
1|
2| }
   -<

On the left hand side we first have the line numbers, a pipe separator, and finally the source code. The range is visualized by starting after > and ending before <. Note that > and < is excluded from the range. That means a range of length one is >-< and an empty range is ><.

@AndreasArvidsson AndreasArvidsson self-assigned this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant