Skip to content

Commit

Permalink
add config to control assume function is constant or not
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingwl committed Jan 15, 2021
1 parent 6ca16d2 commit 44c6e8f
Show file tree
Hide file tree
Showing 27 changed files with 942 additions and 891 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/HearTao/ts-react-hooks-tools.git"
},
"version": "0.1.16",
"version": "0.1.17",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Typescript React hooks Tools",
"description": "Useful refactor of React hooks with TypeScript.",
"publisher": "kingwl",
"version": "0.1.16",
"version": "0.1.17",
"license": "MIT",
"icon": "img/logo.png",
"repository": {
Expand Down Expand Up @@ -42,6 +42,11 @@
"type": "boolean",
"description": "Control whether if collect whole call expression as dependencies",
"default": true
},
"trht.preferConstantCall": {
"type": "boolean",
"description": "Control whether if assume call expression is constants",
"default": true
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const configurationSection = 'trht';

interface SynchronizedConfiguration {
preferFullAccess?: boolean;
preferImmutableCall?: boolean
preferImmutableCall?: boolean;
preferConstantCall?: boolean;
}

export async function activate(context: vscode.ExtensionContext) {
Expand Down Expand Up @@ -43,6 +44,7 @@ function getConfiguration(): SynchronizedConfiguration {

withConfigValue(config, outConfig, 'preferFullAccess');
withConfigValue(config, outConfig, 'preferImmutableCall');
withConfigValue(config, outConfig, 'preferConstantCall');

return outConfig;
}
Expand Down
Loading

0 comments on commit 44c6e8f

Please sign in to comment.