Skip to content

Commit 05475ea

Browse files
committed
Lint
1 parent 6f37980 commit 05475ea

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

atest/05_Features/Completion.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Shows Only Relevant Suggestions In Known Magics
302302
Enter Cell Editor 20 line=2
303303
Trigger Completer
304304
Completer Should Suggest help
305-
Completer Should Not Suggest from
305+
Completer Should Not Suggest from
306306
Completer Should Suggest hash
307307

308308
Completes In R Magics

packages/jupyterlab-lsp/src/extractors/regexp.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ x = """<a href="#">
2626
</a>""";
2727
print(x)`;
2828

29-
3029
describe('getIndexOfCaptureGroup', () => {
3130
it('extracts index of a captured group', () => {
3231
// tests for https://github.com/krassowski/jupyterlab-lsp/issues/559
@@ -100,18 +99,17 @@ describe('RegExpForeignCodeExtractor', () => {
10099
});
101100

102101
describe('#extract_foreign_code()', () => {
103-
104102
it('should correctly return the range', () => {
105-
let results = python_cell_extractor.extract_foreign_code(PYTHON_CELL_MAGIC_WITH_H);
103+
let results = python_cell_extractor.extract_foreign_code(
104+
PYTHON_CELL_MAGIC_WITH_H
105+
);
106106
expect(results.length).to.equal(1);
107107

108108
let result = results[0];
109109

110110
// test against https://github.com/krassowski/jupyterlab-lsp/issues/559
111111
expect(result.host_code).to.equal(PYTHON_CELL_MAGIC_WITH_H);
112-
expect(result.foreign_code).to.equal(
113-
'h'
114-
);
112+
expect(result.foreign_code).to.equal('h');
115113

116114
expect(result.range.start.line).to.equal(1);
117115
expect(result.range.start.column).to.equal(0);

packages/jupyterlab-lsp/src/extractors/regexp.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ import { position_at_offset } from '../positioning';
33
import { replacer } from '../overrides/tokens';
44
import { CodeEditor } from '@jupyterlab/codeeditor';
55

6-
7-
export function getIndexOfCaptureGroup(expression: RegExp, matched_string: string, value_of_captured_group: string): number {
6+
export function getIndexOfCaptureGroup(
7+
expression: RegExp,
8+
matched_string: string,
9+
value_of_captured_group: string
10+
): number {
811
// TODO: use https://github.com/tc39/proposal-regexp-match-indices once supported in >95% of browsers
912
// (probably around 2025)
1013

@@ -16,7 +19,6 @@ export function getIndexOfCaptureGroup(expression: RegExp, matched_string: strin
1619
let full_matched = captured_groups[0];
1720

1821
for (let group of captured_groups.slice(1)) {
19-
2022
if (typeof group === 'undefined') {
2123
continue;
2224
}
@@ -69,8 +71,14 @@ export class RegExpForeignCodeExtractor implements IForeignCodeExtractor {
6971
let match: RegExpExecArray = this.global_expression.exec(code);
7072
let host_code_fragment: string;
7173

72-
let new_api_replacer = typeof this.options.foreign_replacer !== 'undefined' ? this.options.foreign_replacer : ('$' + this.options.foreign_capture_group);
73-
const replacer = typeof this.options.extract_to_foreign !== 'undefined' ? this.options.extract_to_foreign : new_api_replacer;
74+
let new_api_replacer =
75+
typeof this.options.foreign_replacer !== 'undefined'
76+
? this.options.foreign_replacer
77+
: '$' + this.options.foreign_capture_group;
78+
const replacer =
79+
typeof this.options.extract_to_foreign !== 'undefined'
80+
? this.options.extract_to_foreign
81+
: new_api_replacer;
7482

7583
while (match != null) {
7684
let matched_string = match[0];
@@ -118,11 +126,12 @@ export class RegExpForeignCodeExtractor implements IForeignCodeExtractor {
118126
}
119127

120128
const foreign_group_index_in_match = getIndexOfCaptureGroup(
121-
this.expression, matched_string, foreign_code_group_value
129+
this.expression,
130+
matched_string,
131+
foreign_code_group_value
122132
);
123133

124-
let start_offset =
125-
match.index + foreign_group_index_in_match;
134+
let start_offset = match.index + foreign_group_index_in_match;
126135

127136
let start = position_at_offset(start_offset, lines);
128137
let end = position_at_offset(

packages/jupyterlab-lsp/src/transclusions/ipython-rpy2/extractors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { RegExpForeignCodeExtractor } from '../../extractors/regexp';
33
import { extract_r_args, rpy2_args_pattern, RPY2_MAX_ARGS } from './rpy2';
44

55
function create_rpy_code_extractor(strip_leading_space: boolean) {
6-
76
function rpy2_code_extractor(match: string, ...args: string[]) {
87
let r = extract_r_args(args, -3);
98
let code: string;
@@ -17,7 +16,7 @@ function create_rpy_code_extractor(strip_leading_space: boolean) {
1716
return code;
1817
}
1918

20-
return rpy2_code_extractor
19+
return rpy2_code_extractor;
2120
}
2221

2322
let rpy2_code_extractor_non_stripping = create_rpy_code_extractor(false);

0 commit comments

Comments
 (0)