<file_sep># Hemingway

A reverse engineered version of Hemingway editor for VSCode.
Inspired from https://www.freecodecamp.org/news/https-medium-com-samwcoding-deconstructing-the-hemingway-app-8098e22d878d/

-   Uses https://www.npmjs.com/package/retext-english + Unified
-   Naive perf, parses the full doc at all times.

## Structure

```
.
├── client // Language Client
│   ├── src
│   │   ├── test // End to End tests for Language Client / Server
│   │   └── extension.ts // Language Client entry point
├── package.json // The extension manifest.
└── server // Language Server
    └── src
        └── server.ts // Language Server entry point
```
<file_sep>import type {Processor} from "unified";

export type {Processor};
export function importUnified(): Promise<Processor>;
<file_sep>let instance = null;

async function importUnified() {
  if (!instance) {
    // Father forgive me for I have sinned
    // It's debatable whether this server can be distributed
    // as an ESM module. Needs more time.
    // This is a hack to import a Pure ESM module into a CommonJS package.
    const { processor } = await import('processor');
    return (instance = processor);
  }

  return instance;
}

exports.importUnified = importUnified;
<file_sep>import type {Plugin} from 'unified';
import type {Root} from 'nlcst';

export default function longSentences(): Plugin<void[], Root, string> {
  return (tree: any, file: any) => {
    console.log(tree);
    return;
  };
}
<file_sep>import retextEnglish from 'retext-english';
import retextPassive from 'retext-passive';
import retextStringify from 'retext-stringify';
import longSentences from './long-sentences.js';
import { unified } from 'unified';

export const processor = unified()
  .use(retextEnglish)
  .use(retextPassive)
  .use(longSentences)
  .use(retextStringify);
