dependabot[bot] 558fadd85e Bump minimatch and mocha in /extension/code-editor-integration 2 anni fa
..
src 3b41349862 refactored plugin file + updated readme's 4 anni fa
.eslintignore 39bd71b1c9 Updated root + plugin README 4 anni fa
.eslintrc.json 39aed70e58 updated eslint rules to disable semicolons 4 anni fa
.gitignore 39bd71b1c9 Updated root + plugin README 4 anni fa
README.md ea9795f7ed docs: fix simple typo, ecapsulated -> encapsulated 2 anni fa
package-lock.json 558fadd85e Bump minimatch and mocha in /extension/code-editor-integration 2 anni fa
package.json 558fadd85e Bump minimatch and mocha in /extension/code-editor-integration 2 anni fa
tsconfig.json 39bd71b1c9 Updated root + plugin README 4 anni fa

README.md

Code Editor Integration Development

Node.js CI

Simplifies the process of integrating howdoi as a code editor extension.

Description

The Code Editor Integration plug-in is ran by calling the runHowdoi function which takes in a user's query of type string. The parameter is encapsulated by a single line comment and is formatted as follows:

// howdoi query

runHowdoi returns an Object with the structure:

{
    question: string
    answer: string[]
    link: string[] 
}

The Object values:

  • question contains the user's query encapsulated by a single line comment
  • answer contains the three possible answers to the user's query
  • link contains the three possible links to the answer encapsulated by a single line comment

Installation

First, install howdoi on your machine.

Then, install all necessary packages:

npm install

Development

To compile the script:

npm run compile

To run the script:

npm start

To compile and run the script:

npm run build

To run the testing script:

npm test

Integration

To utilize this plug-in to create a howdoi extension for a code editor:

  1. Copy the code-editor-integration folder into your workspace and remove the node_modules folder by adding the script

    "copy": "ncp ../code-editor-integration/ src/code-editor-integration/"
    "clean": "rimraf ./src/code-editor-integration/node_modules"
    

    into your package.json file and running it. First, you will need to install ncp and rimraf.

  2. Import the plugin.ts file into your main file.

  3. Call the runHowdoi function.

Refer to vscode-howdoi for an example.

Usage

usage:

// howdoi query [-n NUM_ANSWERS]

positional arguments:

  QUERY                 the question to answer

optional arguments:

  -n NUM_ANSWERS        NUM_ANSWERS
                        number of answers to return
                        (default: 3)