-
Notifications
You must be signed in to change notification settings - Fork 5
RIP 0.1 Reach TypeScript Design Style Request #39
base: master
Are you sure you want to change the base?
Conversation
Needs UnitTests for handling the string interpolation in VSCode notice some funny behaviour and documentation for creating additional plug-ins. |
@@ -0,0 +1,29 @@ | |||
export enum CMD_HELPER { | |||
COMPILE = <any>'compile', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why <any>
?
@@ -1,6 +1,15 @@ | |||
import { ExtensionContext } from 'vscode'; | |||
import * as vscode from 'vscode'; | |||
|
|||
const REACH_COMPILE_S:string = 'Reach Compile'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as previous PR
@@ -0,0 +1,32 @@ | |||
export class CONSTANTS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer only things that are used more than once are abstracted to constants. Otherwise, I find it easier to have the values inlined
public static CANNOT_CREATE_SETTINGS:string = `Could not create .vscode/settings.json:`; | ||
public static REACH_PATH:string = './reach'; | ||
public static REACH_CLIENT_ID:string = 'reachide'; | ||
public static CREATE_FILESYSTEM_WATCHER_PARAM:string = '**/*.rsh'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static RECURSIVE_REACH_FILE_SELECTOR : string = '**/*.rsh'
public static fs = require('fs'); | ||
public static url = require('url'); | ||
|
||
public static REACH_IDE_S:string = 'Reach IDE'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: drop the _S
cmdHelper(value); | ||
} | ||
|
||
urlHelper(context, URL_HELPER.DOCS, URL_HELPER.DOCS_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just make this:
const helperUrls = {
'docs': 'https://docs.reach.sh/doc-index.html',
// ...
}
for (const [key, value] of Object.entries(helperUrls)) {
urlHelper(context, key, value);
}
Thanks for the input valid points. I will add these style changes and resubmit |
There are areas in the code where the same string is used multiple times. I think it would be a good idea to start making these
const
wherever possible.