Skip to content

Commit 17e277b

Browse files
committed
add types to docstrings
1 parent b98e124 commit 17e277b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib_src/misc/scopes.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ const openers = [
2525
]
2626
const reopeners = ["else", "elseif", "catch", "finally"]
2727

28+
/**
29+
*
30+
* @param {readonly string[]} scopes
31+
*/
2832
function isKeywordScope(scopes: readonly string[]) {
2933
// Skip 'source.julia'
3034
return scopes.slice(1).some(scope => {
3135
return scope.indexOf("keyword") > -1
3236
})
3337
}
3438

39+
/**
40+
*
41+
* @param {readonly string[]} scopes
42+
*/
3543
export function isStringScope(scopes: readonly string[]) {
3644
let isString = false
3745
let isInterp = false
@@ -46,6 +54,11 @@ export function isStringScope(scopes: readonly string[]) {
4654
return isString && !isInterp
4755
}
4856

57+
/**
58+
*
59+
* @param {TextEditor} editor
60+
* @param {RangeCompatible} range
61+
*/
4962
function forRange(editor: TextEditor, range: RangeCompatible) {
5063
// this should happen here and not a top-level so that we aren't relying on
5164
// Atom to load packages in a specific order:
@@ -90,13 +103,23 @@ function forRange(editor: TextEditor, range: RangeCompatible) {
90103
return scopes
91104
}
92105

106+
/**
107+
*
108+
* @param {TextEditor} editor
109+
* @param {number} start
110+
* @param {number} end
111+
*/
93112
export function forLines(editor: TextEditor, start: number, end: number) {
94113
const startPoint = new Point(start, 0)
95114
const endPoint = new Point(end, Infinity)
96115
const range = new Range(startPoint, endPoint)
97116
return forRange(editor, range)
98117
}
99118

119+
/**
120+
*
121+
* @param {readonly string[]} scopes
122+
*/
100123
export function isCommentScope(scopes: readonly string[]) {
101124
// Skip 'source.julia'
102125
return scopes.slice(1).some(scope => {
@@ -108,6 +131,9 @@ export function isCommentScope(scopes: readonly string[]) {
108131
* Returns `true` if the scope at `bufferPosition` in `editor` is valid code scope to be inspected.
109132
* Supposed to be used within Atom-IDE integrations, whose `grammarScopes` setting doesn't support
110133
* embedded scopes by default.
134+
*
135+
* @param {TextEditor} editor
136+
* @param {PointCompatible} bufferPosition
111137
*/
112138
export function isValidScopeToInspect(editor: TextEditor, bufferPosition: PointCompatible) {
113139
const scopes = editor.scopeDescriptorForBufferPosition(bufferPosition).getScopesArray()

0 commit comments

Comments
 (0)