Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Node.js CI

on:
push:
branches: [ master, vscode-ext]
branches: [ master, vscode-ext, plugin-cli]
paths: [ 'extension/**']
pull_request:
branches: [ master ]
Expand Down Expand Up @@ -57,3 +57,25 @@ jobs:
npm run lint
npm test
working-directory: ./extension/vscode-howdoi

job_3:
name: Plugin CLI

runs-on: macos-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
npm ci
npm run build --if-present
npm run precompile
npm run lint
working-directory: ./extension/plugin-cli
16 changes: 4 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,22 +188,14 @@ Or parse it yourself (either work):
Extension Development
---------------------

To simplify the process of integrating howdoi as a code editor extension, edit the files within the ``extension/code-editor-integration`` folder.
To simplify the process of integrating howdoi as a code editor extension, edit the files within the `extension/code-editor-integration folder <https://github.com/gleitz/howdoi/tree/master/extension/code-editor-integration>`_.

To improve upon the Visual Studio Code howdoi extension, edit the files within the ``extension/vscode-ext`` folder and republish the extension.
To improve upon the Visual Studio Code howdoi extension, edit the files within the `extension/vscode-ext folder <https://github.com/gleitz/howdoi/tree/master/extension/vscode-howdoi>`_ and republish the extension.

Code Editor Integration
~~~~~~~~~~~~~~~~~~~~~~~

To begin development for the howdoi code editor integration plug-in, install howdoi on your machine.

Then, install all necessary packages:

::

npm install

Continue to the ``README.md`` within the ``extension/code-editor-integration`` folder for an in depth explanation.
Head over to the `README.md <https://github.com/gleitz/howdoi/blob/master/extension/code-editor-integration/README.md>`_ for an in depth explanation on beginning development for the howdoi code editor integration plug-in.

Visual Studio Code Extension
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -231,7 +223,7 @@ howdoi can now be installed as an extension on Visual Studio Code! There are two
- (coming soon)

2. Directly from the packaged extension:
- (coming soon)
- To locally install the howdoi Visual Studio Code package, head over `here <https://github.com/gleitz/howdoi/tree/master/extension/vscode-pkg/README.md>`_.

Contributing
------------
Expand Down
1 change: 1 addition & 0 deletions extension/code-editor-integration/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Code Editor Integration Development
![Node.js CI](https://github.com/gleitz/howdoi/workflows/Node.js%20CI/badge.svg)

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

Expand Down
5 changes: 5 additions & 0 deletions extension/code-editor-integration/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion extension/code-editor-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {},
"dependencies": {
"loglevel": "^1.6.8"
},
"devDependencies": {
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
Expand Down
8 changes: 5 additions & 3 deletions extension/code-editor-integration/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'
import * as cp from 'child_process'
import {once} from 'events'
import * as log from 'loglevel'
import {HOWDOI_PREFIX, HowdoiObj, JSONObj, CommentChars} from './plugin_interfaces'
import * as removeRegex from './remove_regexes'
import * as findAttr from './find_attributes'
Expand All @@ -9,6 +10,7 @@ import * as createAttr from './create_attributes'
export async function retrieveHowdoiOutput(command: string, numFlagVal: number): Promise<JSONObj[]> {
/* This function spawns an external application in a new process to run the howdoi query and returns
the howdoi query answer formatted as a JSONObj[] */
log.setLevel('warn')
const numFlag: string = '-n' + String(numFlagVal)
const process = cp.spawn(HOWDOI_PREFIX, [command, numFlag, '-j'])
let howdoiJSON: JSONObj[] = [{ answer: '', link: '', position: ''}]
Expand All @@ -18,15 +20,15 @@ export async function retrieveHowdoiOutput(command: string, numFlagVal: number):
})

process.stderr.on('dataErr', (dataErr: Buffer) => {
console.log(`stderr: ${dataErr}`)
log.warn(`stderr: ${dataErr}`)
})

process.on('error', (error: Error) => {
console.log(`error: ${error.message}`)
log.warn(`error: ${error.message}`)
})

process.on('close', (code: number) => {
console.log(`child process exited with code ${code}`)
log.info(`child process exited with code ${code}`)
})

// Wait for the child process to exit
Expand Down
2 changes: 2 additions & 0 deletions extension/plugin-cli/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plugin.js
node_modules/
47 changes: 47 additions & 0 deletions extension/plugin-cli/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"max-len": [
"error",
{
"code": 120
}
],
"indent": [
"error",
2,
{
"SwitchCase": 1,
"flatTernaryExpressions": false,
"ignoreComments": false
}
],
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "none", // 'none' or 'semi' or 'comma'
"requireLast": true
},
"singleline": {
"delimiter": "semi", // 'semi' or 'comma'
"requireLast": false
}
}],
"comma-spacing": ["error", { "before": false, "after": true }],
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"quotes": ["error", "single"],
"semi": "off"
}
}
2 changes: 2 additions & 0 deletions extension/plugin-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
out/
Loading