Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ICodeMirror, more type imports, order plugin for fixer #576

Merged
merged 7 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/job.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ matrix.os }}-lint-

- name: Set up Python and mamba
uses: conda-incubator/setup-miniconda@master
uses: conda-incubator/setup-miniconda@v2
with:
condarc-file: .github/.condarc
environment-file: requirements/github-actions.yml
miniforge-variant: Mambaforge
use-mamba: true
Expand Down Expand Up @@ -138,9 +137,8 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ matrix.os }}-build-

- name: Set up Python and mamba
uses: conda-incubator/setup-miniconda@master
uses: conda-incubator/setup-miniconda@v2
with:
condarc-file: .github/.condarc
miniforge-variant: Mambaforge

- name: Install minimal build deps
Expand Down Expand Up @@ -253,9 +251,8 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ matrix.os }}-${{ matrix.python }}-atest-

- name: Set up Python and mamba
uses: conda-incubator/setup-miniconda@master
uses: conda-incubator/setup-miniconda@v2
with:
condarc-file: .github/.condarc
environment-file: requirements/github-actions.yml
miniforge-variant: Mambaforge
use-mamba: true
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"vscode-css-languageserver-bin": "^1.4.0",
"vscode-html-languageserver-bin": "^1.4.0",
"vscode-json-languageserver-bin": "^1.0.1",
"yaml-language-server": "^0.12.0",
"vscode-json-languageservice": "^3.9.1 <3.10.0"
"vscode-json-languageservice": "^3.9.1 <3.10.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember why we have the pin for <3.10.0? It looks like we could update to 3.11.0 or 4.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alas, i do not... it's one of the language servers that might not get updated very often...

Copy link
Member

@krassowski krassowski Apr 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try bumping it then, to make sure we don't stay behind.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it was yaml. they are up on 0.17 now, so presumably work with the newer service.

Of course, it is irrelevant to our JSON language server, because it's a hella old static dump of... some snapshot or another. Anyhow, would prefer to not move too many more rocks on this PR... very scared of finding more things.

"yaml-language-server": "^0.12.0"
},
"husky": {
"hooks": {}
Expand Down
33 changes: 28 additions & 5 deletions packages/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
Expand Down Expand Up @@ -55,12 +58,32 @@ module.exports = {
'no-undef': 'warn',
'no-useless-escape': 'off',
'prefer-const': 'off',
// deviations from jupyterlab, should not be changed
// a pitfall of enums is that they do not work correctly
// when circular dependencies are present
// (see https://stackoverflow.com/a/59665223/)
'import/no-cycle': 'error',
// the default, but for reference...
'import/order': [
'warn',
{
groups: [
'builtin',
'external',
'parent',
'sibling',
'index',
'object',
'unknown'
],
pathGroups: [
{ pattern: 'react/**', group: 'builtin', order: 'after' },
{ pattern: 'codemirror/**', group: 'external', order: 'before' },
{ pattern: '@lumino/**', group: 'external', order: 'before' },
{ pattern: '@jupyterlab/**', group: 'external', order: 'after' }
],
'newlines-between': 'always',
alphabetize: { order: 'asc' }
}
],
// deviations from jupyterlab, should probably be fixed
'import/no-cycle': 'off', // somehow we lapsed here... ~200 cycles now
'import/export': 'off', // we do class/interface + NS pun exports _all over_
'@typescript-eslint/triple-slash-reference': 'off',
'jest/no-test-callback': 'off',
'jest/valid-expect': 'off',
Expand Down
3 changes: 1 addition & 2 deletions packages/_example-extractor/src/api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { IExtractedCode } from '@krassowski/jupyterlab-lsp';
import { expect } from 'chai';

import { extractor } from '.';

import { IExtractedCode } from '@krassowski/jupyterlab-lsp';

const EXAMPLE = `%%foo
bar
`;
Expand Down
1 change: 0 additions & 1 deletion packages/_example-extractor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';

import {
ILSPCodeExtractorsManager,
RegExpForeignCodeExtractor
Expand Down
3 changes: 2 additions & 1 deletion packages/code-jumpers/src/history.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IGlobalPosition } from './positions';
import { IModelDB, IObservableUndoableList } from '@jupyterlab/observables';
import { JSONValue } from '@lumino/coreutils';

import { IGlobalPosition } from './positions';

const DB_ENTRY = 'jumpy_history';

export class JumpHistory {
Expand Down
2 changes: 1 addition & 1 deletion packages/code-jumpers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FileEditorJumper } from './jumpers/fileeditor';
import { CodeJumper } from './jumpers/jumper';
import { NotebookJumper } from './jumpers/notebook';
import { FileEditorJumper } from './jumpers/fileeditor';

export { CodeJumper, NotebookJumper, FileEditorJumper };
10 changes: 6 additions & 4 deletions packages/code-jumpers/src/jumpers/fileeditor.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { CodeEditor } from '@jupyterlab/codeeditor';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { FileEditor } from '@jupyterlab/fileeditor';

import { JumpHistory } from '../history';
import { IGlobalPosition, ILocalPosition } from '../positions';

import { CodeJumper, jumpers } from './jumper';
import { JumpHistory } from '../history';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { CodeEditor } from '@jupyterlab/codeeditor';

export class FileEditorJumper extends CodeJumper {
editor: FileEditor;
Expand Down
9 changes: 5 additions & 4 deletions packages/code-jumpers/src/jumpers/jumper.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Dialog, showDialog } from '@jupyterlab/apputils';
import { CodeEditor } from '@jupyterlab/codeeditor';

import { IGlobalPosition, ILocalPosition } from '../positions';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { JumpHistory } from '../history';
import { FileEditor } from '@jupyterlab/fileeditor';

import { JumpHistory } from '../history';
import { IGlobalPosition, ILocalPosition } from '../positions';

import IEditor = CodeEditor.IEditor;
import { Dialog, showDialog } from '@jupyterlab/apputils';

const movement_keys = [
'ArrowRight',
Expand Down
11 changes: 6 additions & 5 deletions packages/code-jumpers/src/jumpers/notebook.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';
import { CodeEditor } from '@jupyterlab/codeeditor';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';

import { CodeJumper, jumpers } from './jumper';
import { IGlobalPosition, ILocalPosition } from '../positions';
import { _ensureFocus } from '../notebook_private';
import { JumpHistory } from '../history';
import { CodeEditor } from '@jupyterlab/codeeditor';
import { _ensureFocus } from '../notebook_private';
import { IGlobalPosition, ILocalPosition } from '../positions';

import { CodeJumper, jumpers } from './jumper';

export class NotebookJumper extends CodeJumper {
notebook: Notebook;
Expand Down
7 changes: 4 additions & 3 deletions packages/completion-theme/src/about.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { LabIcon } from '@jupyterlab/ui-components';
import React, { ReactElement } from 'react';

import {
COMPLETER_THEME_PREFIX,
ICompletionTheme,
ILicenseInfo,
COMPLETER_THEME_PREFIX
ILicenseInfo
} from './types';
import { LabIcon } from '@jupyterlab/ui-components';

function render_licence(licence: ILicenseInfo): ReactElement {
return (
Expand Down
15 changes: 8 additions & 7 deletions packages/completion-theme/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { kernelIcon, LabIcon } from '@jupyterlab/ui-components';
import '../style/index.css';
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
import {
Dialog,
ICommandPalette,
IThemeManager,
showDialog
} from '@jupyterlab/apputils';
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
import { LabIcon, kernelIcon } from '@jupyterlab/ui-components';

import { render_themes_list } from './about';
import {
COMPLETER_THEME_PREFIX,
CompletionItemKindStrings,
ICompletionIconSet,
ICompletionTheme,
ILSPCompletionThemeManager,
PLUGIN_ID,
COMPLETER_THEME_PREFIX,
KernelKind,
CompletionItemKindStrings
PLUGIN_ID
} from './types';
import { render_themes_list } from './about';
import '../style/index.css';

export class CompletionThemeManager implements ILSPCompletionThemeManager {
protected current_icons: Map<string, LabIcon>;
Expand Down
2 changes: 1 addition & 1 deletion packages/completion-theme/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Token } from '@lumino/coreutils';
import { LabIcon } from '@jupyterlab/ui-components';
import { Token } from '@lumino/coreutils';

export const COMPLETER_THEME_PREFIX = 'lsp-completer-theme-';

Expand Down
12 changes: 7 additions & 5 deletions packages/jupyterlab-lsp/src/adapter_manager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import type { IClassicShell } from '@jupyterlab-classic/application';
import { ILabShell, JupyterFrontEndPlugin } from '@jupyterlab/application';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { Signal } from '@lumino/signaling';

import { WidgetAdapter } from './adapters/adapter';
import {
IAdapterRegistration,
IAdapterTypeOptions,
ILSPAdapterManager,
PLUGIN_ID
} from './tokens';
import { Signal } from '@lumino/signaling';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { WidgetAdapter } from './adapters/adapter';
import { ILabShell, JupyterFrontEndPlugin } from '@jupyterlab/application';

import { LSPExtension } from './index';
import type { IClassicShell } from '@jupyterlab-classic/application';

export class WidgetAdapterManager implements ILSPAdapterManager {
adapterTypeAdded: Signal<
Expand Down
18 changes: 10 additions & 8 deletions packages/jupyterlab-lsp/src/adapters/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { JupyterFrontEnd } from '@jupyterlab/application';
import { CodeEditor } from '@jupyterlab/codeeditor';
import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
import { IVirtualEditor } from '../virtual/editor';
import { IForeignContext, VirtualDocument } from '../virtual/document';
import { JSONObject } from '@lumino/coreutils';
import { Signal } from '@lumino/signaling';
import { IRootPosition, IVirtualPosition } from '../positioning';
import { LSPConnection } from '../connection';

import { ICommandContext } from '../command_manager';
import { JSONObject } from '@lumino/coreutils';
import { LSPConnection } from '../connection';
import {
DocumentConnectionManager,
IDocumentConnectionData,
ISocketConnectionOptions
} from '../connection_manager';
import { ILSPExtension, ILSPLogConsole } from '../index';
import { IFeatureEditorIntegration, IFeature } from '../feature';
import { EditorAdapter } from '../editor_integration/editor_adapter';
import IEditor = CodeEditor.IEditor;
import { IFeature, IFeatureEditorIntegration } from '../feature';
import { ILSPExtension, ILSPLogConsole } from '../index';
import { LanguageIdentifier } from '../lsp';
import { IRootPosition, IVirtualPosition } from '../positioning';
import { IForeignContext, VirtualDocument } from '../virtual/document';
import { IVirtualEditor } from '../virtual/editor';

import IEditor = CodeEditor.IEditor;

export class StatusMessage {
/**
Expand Down
16 changes: 9 additions & 7 deletions packages/jupyterlab-lsp/src/adapters/file_editor/file_editor.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { WidgetAdapter } from '../adapter';
import { FileEditor } from '@jupyterlab/fileeditor';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { CodeMirrorEditor } from '@jupyterlab/codemirror';
import { CodeEditor } from '@jupyterlab/codeeditor';
import { LSPExtension } from '../../index';
import { CodeMirrorEditor } from '@jupyterlab/codemirror';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { FileEditor } from '@jupyterlab/fileeditor';

import { ICommandContext } from '../../command_manager';
import { PositionConverter } from '../../converter';
import { LSPExtension } from '../../index';
import { IRootPosition, IVirtualPosition } from '../../positioning';
import { ICommandContext } from '../../command_manager';
import { VirtualDocument } from '../../virtual/document';
import { IVirtualEditor } from '../../virtual/editor';
import { WidgetAdapter } from '../adapter';

import IEditor = CodeEditor.IEditor;
import { VirtualDocument } from '../../virtual/document';

export class FileEditorAdapter extends WidgetAdapter<
IDocumentWidget<FileEditor>
Expand Down
8 changes: 5 additions & 3 deletions packages/jupyterlab-lsp/src/adapters/file_editor/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
import { ILSPAdapterManager, PLUGIN_ID } from '../../tokens';
import { IEditorTracker } from '@jupyterlab/fileeditor';
import { FileEditorAdapter } from './file_editor';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { IEditorTracker } from '@jupyterlab/fileeditor';

import { CommandEntryPoint } from '../../command_manager';
import { ILSPAdapterManager, PLUGIN_ID } from '../../tokens';

import { FileEditorAdapter } from './file_editor';

export const FileEditorContextMenuEntryPoint: CommandEntryPoint =
'file-editor-context-menu';
Expand Down
8 changes: 5 additions & 3 deletions packages/jupyterlab-lsp/src/adapters/notebook/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { CommandEntryPoint } from '../../command_manager';
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { INotebookTracker } from '@jupyterlab/notebook';

import { CommandEntryPoint } from '../../command_manager';
import {
IAdapterTypeOptions,
ILSPAdapterManager,
PLUGIN_ID
} from '../../tokens';
import { INotebookTracker } from '@jupyterlab/notebook';

import { NotebookAdapter } from './notebook';
import { IDocumentWidget } from '@jupyterlab/docregistry';

export const CellContextMenuEntryPoint: CommandEntryPoint =
'notebook-cell-context-menu';
Expand Down
28 changes: 15 additions & 13 deletions packages/jupyterlab-lsp/src/adapters/notebook/notebook.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { WidgetAdapter } from '../adapter';
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';
import { until_ready } from '../../utils';
import { SessionContext } from '@jupyterlab/apputils';
import { Cell, ICellModel } from '@jupyterlab/cells';
import { CodeEditor } from '@jupyterlab/codeeditor';
import * as nbformat from '@jupyterlab/nbformat';
import ILanguageInfoMetadata = nbformat.ILanguageInfoMetadata;
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';
import {
IObservableList,
IObservableUndoableList
} from '@jupyterlab/observables';
import { Session } from '@jupyterlab/services';
import { SessionContext } from '@jupyterlab/apputils';
import { LSPExtension } from '../../index';

import { ICommandContext } from '../../command_manager';
import { PositionConverter } from '../../converter';
import { LSPExtension } from '../../index';
import { IEditorPosition, IVirtualPosition } from '../../positioning';
import { ICommandContext } from '../../command_manager';
import { CodeEditor } from '@jupyterlab/codeeditor';
import IEditor = CodeEditor.IEditor;
import { until_ready } from '../../utils';
import { VirtualDocument } from '../../virtual/document';
import {
IObservableUndoableList,
IObservableList
} from '@jupyterlab/observables';
import { WidgetAdapter } from '../adapter';

import IEditor = CodeEditor.IEditor;
import ILanguageInfoMetadata = nbformat.ILanguageInfoMetadata;

export class NotebookAdapter extends WidgetAdapter<NotebookPanel> {
editor: Notebook;
Expand Down
Loading