Skip to content

Commit

Permalink
Keep get_breadcrumbs as deprecated to avoid breaking compatibility
Browse files Browse the repository at this point in the history
in case if anyone uses it
  • Loading branch information
krassowski committed Oct 9, 2021
1 parent 9bd55aa commit e5363da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/jupyterlab-lsp/src/components/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function create_dummy_document(options: Partial<VirtualDocument.IOptions>) {
});
}

describe('get_breadcrumbs', () => {
describe('getBreadcrumbs', () => {
const trans = nullTranslator.load('jupyterlab_lsp');
it('should collapse long paths', () => {
let document = create_dummy_document({
Expand Down
18 changes: 16 additions & 2 deletions packages/jupyterlab-lsp/src/components/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { TranslationBundle } from '@jupyterlab/translation';
import { nullTranslator, TranslationBundle } from '@jupyterlab/translation';
import React from 'react';

import { WidgetAdapter } from '../adapters/adapter';
Expand All @@ -8,9 +8,12 @@ import { VirtualDocument } from '../virtual/document';
export function getBreadcrumbs(
document: VirtualDocument,
adapter: WidgetAdapter<IDocumentWidget>,
trans: TranslationBundle,
trans?: TranslationBundle,
collapse = true
): JSX.Element[] {
if (!trans) {
trans = nullTranslator.load('');
}
return document.ancestry.map((document: VirtualDocument) => {
if (!document.parent) {
let path = document.path;
Expand Down Expand Up @@ -64,6 +67,17 @@ export function getBreadcrumbs(
});
}

/**
* @deprecated please use getBreadcrumbs instead; `get_breadcrumbs` will be removed in 4.0
*/
export function get_breadcrumbs(
document: VirtualDocument,
adapter: WidgetAdapter<IDocumentWidget>,
collapse = true
) {
return getBreadcrumbs(document, adapter, null, collapse);
}

export function focus_on(node: HTMLElement) {
if (!node) {
return;
Expand Down

0 comments on commit e5363da

Please sign in to comment.