File tree Expand file tree Collapse file tree 4 files changed +2
-43
lines changed
packages/jupyterlab-go-to-definition Expand file tree Collapse file tree 4 files changed +2
-43
lines changed Original file line number Diff line number Diff line change 26
26
"build" : " tsc -b" ,
27
27
"bundle" : " npm pack ." ,
28
28
"clean" : " rimraf lib" ,
29
- "lab:link" : " jupyter labextension link . --no-build" ,
30
- "test" : " jlpm jest --coverage --coverageReporters=cobertura --coverageReporters=html --coverageReporters=text-summary"
29
+ "lab:link" : " jupyter labextension link . --no-build"
31
30
},
32
31
"peerDependencies" : {
33
32
"@jupyterlab/application" : " ~2.2.0" ,
Original file line number Diff line number Diff line change @@ -5,11 +5,9 @@ import { JumpHistory } from '../history';
5
5
import { IDocumentManager } from '@jupyterlab/docmanager' ;
6
6
import { IDocumentWidget } from '@jupyterlab/docregistry' ;
7
7
import { CodeEditor } from '@jupyterlab/codeeditor' ;
8
- import { PathExt } from '@jupyterlab/coreutils' ;
9
8
10
9
export class FileEditorJumper extends CodeJumper {
11
10
editor : FileEditor ;
12
- language : string ;
13
11
widget : IDocumentWidget ;
14
12
15
13
constructor (
@@ -21,32 +19,12 @@ export class FileEditorJumper extends CodeJumper {
21
19
this . document_manager = document_manager ;
22
20
this . editor = editor_widget . content ;
23
21
this . history = new JumpHistory ( this . editor . model . modelDB ) ;
24
- this . setLanguageFromMime ( this . editor . model . mimeType ) ;
25
-
26
- this . editor . model . mimeTypeChanged . connect ( ( session , mimeChanged ) => {
27
- this . setLanguageFromMime ( mimeChanged . newValue ) ;
28
- } ) ;
29
22
}
30
23
31
24
get path ( ) {
32
25
return this . widget . context . path ;
33
26
}
34
27
35
- get cwd ( ) {
36
- return PathExt . dirname ( this . path ) ;
37
- }
38
-
39
- setLanguageFromMime ( mime : string ) {
40
- let type = mime . replace ( 'text/x-' , '' ) ;
41
- switch ( type ) {
42
- case 'rsrc' :
43
- this . language = 'R' ;
44
- break ;
45
- default :
46
- this . language = type ;
47
- }
48
- }
49
-
50
28
get editors ( ) {
51
29
return [ this . editor . editor ] ;
52
30
}
Original file line number Diff line number Diff line change @@ -38,8 +38,6 @@ const system_keys = [
38
38
] ;
39
39
40
40
export abstract class CodeJumper {
41
- abstract language : string ;
42
-
43
41
document_manager : IDocumentManager ;
44
42
widget : IDocumentWidget ;
45
43
@@ -76,7 +74,6 @@ export abstract class CodeJumper {
76
74
. then ( ( ) => {
77
75
this . go_to_position (
78
76
document_widget ,
79
- // TODO - not anymore!
80
77
position . contents_path . endsWith ( '.ipynb' ) ? 'notebook' : 'fileeditor' ,
81
78
position . column ,
82
79
position . line ,
@@ -137,8 +134,6 @@ export abstract class CodeJumper {
137
134
) ;
138
135
}
139
136
140
- abstract get cwd ( ) : string ;
141
-
142
137
protected abstract jump ( position : ILocalPosition ) : void ;
143
138
144
139
global_jump_back ( ) {
Original file line number Diff line number Diff line change 1
1
import { Notebook , NotebookPanel } from '@jupyterlab/notebook' ;
2
- import * as nbformat from '@jupyterlab/nbformat' ;
3
2
import { IDocumentManager } from '@jupyterlab/docmanager' ;
4
3
5
4
import { CodeJumper , jumpers } from './jumper' ;
@@ -23,22 +22,10 @@ export class NotebookJumper extends CodeJumper {
23
22
this . document_manager = document_manager ;
24
23
}
25
24
26
- get cwd ( ) {
27
- return this . widget . model . modelDB . basePath . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
28
- }
29
-
30
25
get editors ( ) {
31
26
return this . notebook . widgets . map ( cell => cell . editor ) ;
32
27
}
33
28
34
- get language ( ) {
35
- let languageInfo = this . notebook . model . metadata . get (
36
- 'language_info'
37
- ) as nbformat . ILanguageInfoMetadata ;
38
- // TODO: consider version of the language as well
39
- return languageInfo . name ;
40
- }
41
-
42
29
jump ( position : ILocalPosition ) {
43
30
let { token, index } = position ;
44
31
@@ -66,7 +53,7 @@ export class NotebookJumper extends CodeJumper {
66
53
let position = this . editors [
67
54
this . notebook . activeCellIndex
68
55
] . getCursorPosition ( ) ;
69
- console . log ( 'file path: ' , this . widget . context . path ) ;
56
+
70
57
return {
71
58
editor_index : this . notebook . activeCellIndex ,
72
59
line : position . line ,
You can’t perform that action at this time.
0 commit comments