open-index/open-npm huggingface dataset:
npm package: @sourcegraph/lexical__react
Description: (FORK of @lexical/react) This package provides Lexical components and hooks for React applications.
Latest version: 0.17.0-dev

# `@lexical/react`

This package provides a set of components and hooks for Lexical that allow for text editing in React applications.

## Getting started

Install `lexical` and `@lexical/react`:

```
npm install --save lexical @lexical/react
```

Below is an example of a basic plain text editor using `lexical` and `@lexical/react` ([try it yourself](https://stackblitz.com/github/facebook/lexical/tree/main/examples/react-plain-text?embed=1&file=src%2FApp.tsx&terminalHeight=0&ctl=1&showSidebar=0&devtoolsheight=0&view=preview)).

```jsx
import {$getRoot, $getSelection} from 'lexical';
import {useEffect} from 'react';

import {LexicalComposer} from '@lexical/react/LexicalComposer';
import {PlainTextPlugin} from '@lexical/react/LexicalPlainTextPlugin';
import {ContentEditable} from '@lexical/react/LexicalContentEditable';
import {HistoryPlugin} from '@lexical/react/LexicalHistoryPlugin';
import {OnChangePlugin} from '@lexical/react/LexicalOnChangePlugin';
import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';

const theme = {
  // Theme styling goes here
  ...
}

// When the editor changes, you can get notified via the
// LexicalOnChangePlugin!
function onChange(editorState) {
  editorState.read(() => {
    // Read the contents of the EditorState here.
    const root = $getRoot();
    const selection = $getSelection();

    console.log(root, selection);
  });
}

// Lexical React plugins are React components, which makes them
// highly composable. Furthermore, you can lazy load plugins if
// desired, so you don't pay the cost for plugins until you
// actually use them.
function MyCustomAutoFocusPlugin() {
  const [editor] = useLexicalComposerContext();

  

useEffect(() => {
    // Focus the editor when the effect fires!
    editor.focus();
  }, [editor]);

  return null;
}

// Catch any errors that occur during Lexical updates and log them
// or throw them as needed. If you don't throw them, Lexical will
// try to recover gracefully without losing user data.
function onError(error) {
  throw error;
}

function Editor() {
  const initialConfig = {
    namespace: 'MyEditor',
    theme,
    onError,
  };

return (
    <LexicalComposer initialConfig={initialConfig}>
      <PlainTextPlugin
        contentEditable={<ContentEditable />}
        placeholder={<div>Enter some text...</div>}
      />
      <OnChangePlugin onChange={onChange} />
      <HistoryPlugin />
      <MyCustomAutoFocusPlugin />
    </LexicalComposer>
  );
}
```
npm package: @sourcegraph/lsif-python
Description: LSIF indexer for Python
Author: Sourcegraph
Latest version: 0.1.2

# lsif-python

Sourcegraph fork of [pyright](https://github.com/microsoft/pyright) focused on generating LSIF for python projects.

Project is primarily an addition to Pyright. At this time, there are no substantial changes to the `pyright` library.

## Pre-requisites

```
$ # Install lsif-python
$ npm install -g @sourcegraph/lsif-python

$ # Install and add `lsif-typed` to your path and/or project
$ curl -Lo lsif-typed https://github.com/sourcegraph/lsif-typescript/releases/download/v0.1.8/lsif-typed && chmod +x lsif-typed
```

## Usage

```
$ npm install @sourcegraph/lsif-python

$ # NOTE: make sure to activate your virtual environment before running
$ lsif-python index . --projectName $MY_PROJECT

$ # Transform lsif-python output to traditional LSIF format
$ #     (at some point, this step will be removed)
$ lsif-typed dump.lsif-typed > dump.lsif

$ # Make sure to point towards the sourcegraph instance you're interested in uploading to.
$ #     more information at https://github.com/sourcegraph/src-cli
$ src lsif upload
```

## Sourcegraph Example Configuration

```
{
    "index_jobs": [
        {
            "indexer": "nikolaik/python-nodejs",
            "local_steps": [
                "curl -Lo lsif-typed https://github.com/sourcegraph/lsif-typescript/releases/download/v0.1.13/lsif-typed",
                "chmod +x ./lsif-typed",
                "npm install -g @sourcegraph/lsif-python",
                "lsif-python index . --projectName tjdevries-sam --projectVersion 0.1",
                "./lsif-typed dump.lsif-typed > dump.lsif",
            ],
            "indexer_args": [],
            "steps": [],
            "outfile": "",
            "root": ""
        }
    ],
    "shared_steps": []
}
```
npm package: @sourcegraph/lsif-tsc
Description: A tool to create an LSIF dump for TypeScript projects.
Latest version: 0.7.6

# TypeScript LSIF indexer ![Beta](https://img.shields.io/badge/status-beta-orange?style=flat)

Visit https://lsif.dev/ to learn about LSIF.

## Installation

```sh
npm install -g @sourcegraph/lsif-tsc
# OR
yarn global add @sourcegraph/lsif-tsc
```

## Indexing your repository

After installing `lsif-tsc` onto your PATH, you can invoke it with all of the arguments that are available to `tsc`.

Index a TypeScript project by running the following command in the directory with your `tsconfig.json`.

```
$ lsif-tsc -p .
..............
46 file(s), 2787 symbol(s)
Processed in 3.236s
```

Index a Javascript project by running the following command.

```
$ lsif-tsc **/*.js --AllowJs --checkJs
................................
295 file(s), 65535 symbol(s)
Processed in 51.732s
```

The previous command relies on shell expansion to pass a list of filenames to the underlying TypeScript compiler. There is a limit on the number of files that can be passed as a command line argument, so it may be necessary to first dump the project filenames into a temporary file, and load that, as follows:

```
ls -1 **/*.js > inputs.txt
lsif-tsc @inputs.txt --AllowJs --checkJs
```

Use `lsif-tsc --help` for more information.

# Legal Notices

This project began as a bugfix fork of [microsoft/lsif-node](https://github.com/microsoft/lsif-node) and therefore was originally authored by Microsoft. This code was originally and continues to be released under the [MIT License](./LICENSE).