Skip to content

Support other than Python languages to insert the code #17

Open
@ktaletsk

Description

@ktaletsk

Description

Currently, the plus button on the right of image/csv collection name inserts the variable declaration of the path in Python style, i.e. input_path = '/opt/shared/wipp/csv-collections/5e67b3eaef492200094262bb'. This may work in some languages, but it is not a valid command in others and may need different quotes for the path or additional keywords/syntax (i.e. C++).

Proposal

This will affect the following lines: https://github.com/LabShare/jupyterlab-extensions/blob/376706aa0510fdc466f7117ea359d1d62da72d7d/jupyterlab_wipp/src/sidebar.tsx#L219 https://github.com/LabShare/jupyterlab-extensions/blob/376706aa0510fdc466f7117ea359d1d62da72d7d/jupyterlab_wipp/src/sidebar.tsx#L88-L89

We should check the kernel type and pattern match the name of kernel to different declaration styles, e.g.

 file_path_prefix = string_delimiter + "/opt/shared/wipp/collections/"; 
 file_path_suffix = "/images/" + string_delimiter; 
  • Python:
    • const code = `input_path = ${collection_path}`;
    • string_delimiter = `'`;
  • Julia:
    • const code = `input_path = ${collection_path}`;
    • string_delimiter = `"`;
  • C++:
    • const code = `string input_path = ${collection_path}`;
    • string_delimiter = `"`;
  • R:
    • const code = `input_path <- ${collection_path}`;
    • string_delimiter = `'`;
      and so on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions