Skip to content

Commit 72a4927

Browse files
committed
Remove more unused code
1 parent 6ea82f0 commit 72a4927

File tree

4 files changed

+2
-43
lines changed

4 files changed

+2
-43
lines changed

packages/jupyterlab-go-to-definition/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"build": "tsc -b",
2727
"bundle": "npm pack .",
2828
"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"
3130
},
3231
"peerDependencies": {
3332
"@jupyterlab/application": "~2.2.0",

packages/jupyterlab-go-to-definition/src/jumpers/fileeditor.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import { JumpHistory } from '../history';
55
import { IDocumentManager } from '@jupyterlab/docmanager';
66
import { IDocumentWidget } from '@jupyterlab/docregistry';
77
import { CodeEditor } from '@jupyterlab/codeeditor';
8-
import { PathExt } from '@jupyterlab/coreutils';
98

109
export class FileEditorJumper extends CodeJumper {
1110
editor: FileEditor;
12-
language: string;
1311
widget: IDocumentWidget;
1412

1513
constructor(
@@ -21,32 +19,12 @@ export class FileEditorJumper extends CodeJumper {
2119
this.document_manager = document_manager;
2220
this.editor = editor_widget.content;
2321
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-
});
2922
}
3023

3124
get path() {
3225
return this.widget.context.path;
3326
}
3427

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-
5028
get editors() {
5129
return [this.editor.editor];
5230
}

packages/jupyterlab-go-to-definition/src/jumpers/jumper.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ const system_keys = [
3838
];
3939

4040
export abstract class CodeJumper {
41-
abstract language: string;
42-
4341
document_manager: IDocumentManager;
4442
widget: IDocumentWidget;
4543

@@ -76,7 +74,6 @@ export abstract class CodeJumper {
7674
.then(() => {
7775
this.go_to_position(
7876
document_widget,
79-
// TODO - not anymore!
8077
position.contents_path.endsWith('.ipynb') ? 'notebook' : 'fileeditor',
8178
position.column,
8279
position.line,
@@ -137,8 +134,6 @@ export abstract class CodeJumper {
137134
);
138135
}
139136

140-
abstract get cwd(): string;
141-
142137
protected abstract jump(position: ILocalPosition): void;
143138

144139
global_jump_back() {

packages/jupyterlab-go-to-definition/src/jumpers/notebook.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';
2-
import * as nbformat from '@jupyterlab/nbformat';
32
import { IDocumentManager } from '@jupyterlab/docmanager';
43

54
import { CodeJumper, jumpers } from './jumper';
@@ -23,22 +22,10 @@ export class NotebookJumper extends CodeJumper {
2322
this.document_manager = document_manager;
2423
}
2524

26-
get cwd() {
27-
return this.widget.model.modelDB.basePath.split('/').slice(0, -1).join('/');
28-
}
29-
3025
get editors() {
3126
return this.notebook.widgets.map(cell => cell.editor);
3227
}
3328

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-
4229
jump(position: ILocalPosition) {
4330
let { token, index } = position;
4431

@@ -66,7 +53,7 @@ export class NotebookJumper extends CodeJumper {
6653
let position = this.editors[
6754
this.notebook.activeCellIndex
6855
].getCursorPosition();
69-
console.log('file path: ', this.widget.context.path);
56+
7057
return {
7158
editor_index: this.notebook.activeCellIndex,
7259
line: position.line,

0 commit comments

Comments
 (0)