Skip to content

Commit 992f977

Browse files
committed
add option to avoid freezing the editor because of large file scan
1 parent 5d93e04 commit 992f977

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ src/**
77
.gitignore
88
tsconfig.json
99
vsc-extension-quickstart.md
10+
.history
11+
jsconfig.json
12+
.eslintrc.json

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 1.3.0
4+
- add a way to stop the extension from search big files
5+
- fix vendor resolveing
6+
37
## 1.2.5
48
- Optimize regular expressions
59

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@
88
"vscode": "^1.19.0"
99
},
1010
"icon": "images/icon.jpg",
11-
"bugs": {
12-
"url": "https://github.com/codingyu/laravel-goto-view/issues"
13-
},
14-
"homepage": "https://github.com/codingyu/laravel-goto-view/blob/master/README.md",
15-
"repository": {
16-
"type": "git",
17-
"url": "https://github.com/codingyu/laravel-goto-view.git"
18-
},
11+
"repository": "https://github.com/codingyu/laravel-goto-view.git",
1912
"categories": [
2013
"Other"
2114
],
@@ -42,6 +35,11 @@
4235
"default": true,
4336
"description": "Display path name"
4437
},
38+
"laravel_goto_view.maxLinesCount": {
39+
"type": "integer",
40+
"default": 300,
41+
"description": "stop the extension if the opened file lines count is more than"
42+
},
4543
"laravel_goto_view.folders": {
4644
"type": "object",
4745
"default": {

src/providers/linkProvider.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ import * as util from '../util';
1313

1414
export default class LinkProvider implements vsDocumentLinkProvider {
1515
public provideDocumentLinks(doc: TextDocument): ProviderResult<DocumentLink[]> {
16-
let documentLinks = [];
16+
let reg = /(?<=view\(|@include\(|@extends\(|@component\()(['"])[^'"]*\1/g;
1717
let config = workspace.getConfiguration('laravel_goto_view');
18+
let linesCount = doc.lineCount
19+
let documentLinks = [];
1820
let index = 0;
19-
let reg = /(?<=view\(|@include\(|@extends\(|@component\()(['"])[^'"]*\1/g;
2021

21-
if (config.quickJump) {
22-
while (index < doc.lineCount) {
22+
if (config.quickJump && linesCount <= config.maxLinesCount) {
23+
while (index < linesCount) {
2324
let line = doc.lineAt(index);
2425
let result = line.text.match(reg);
2526

@@ -35,6 +36,7 @@ export default class LinkProvider implements vsDocumentLinkProvider {
3536
};
3637
}
3738
}
39+
3840
index++;
3941
}
4042
}

0 commit comments

Comments
 (0)