This repository was archived by the owner on May 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 " React" ,
3232 " Typescript"
3333 ],
34- "version" : " 0.8.8 " ,
34+ "version" : " 0.8.9 " ,
3535 "engines" : {
3636 "vscode" : " ^1.70.0"
3737 },
Original file line number Diff line number Diff line change 1+ import { getUserFingerprint } from "../utils/configurationUtils" ;
2+ import { doMutation } from "./client" ;
3+ import { USE_CREATE_CODIGA_YAML } from "./mutations" ;
4+
5+ /**
6+ * creates a record when the user creates a codiga.yml file through
7+ * our VSCode suggestion popup
8+ */
9+ export async function addCreateCodigaYamlRecord ( ) : Promise < void > {
10+ // Get the fingerprint from localstorage to initiate the request
11+ const userFingerprint = getUserFingerprint ( ) ;
12+
13+ // record that a rule fix has taken place
14+ await doMutation ( USE_CREATE_CODIGA_YAML , {
15+ fingerprint : userFingerprint ,
16+ } ) ;
17+ }
Original file line number Diff line number Diff line change 1+ import { getUserFingerprint } from "../utils/configurationUtils" ;
2+ import { doMutation } from "./client" ;
3+ import { USE_RULE_FIX } from "./mutations" ;
4+
5+ /**
6+ * creates a record when a rule fix was applied in the editor
7+ */
8+ export async function addRuleFixRecord ( ) : Promise < void > {
9+ // Get the fingerprint from localstorage to initiate the request
10+ const userFingerprint = getUserFingerprint ( ) ;
11+
12+ // record that a rule fix has taken place
13+ await doMutation ( USE_RULE_FIX , {
14+ fingerprint : userFingerprint ,
15+ } ) ;
16+ }
Original file line number Diff line number Diff line change @@ -10,3 +10,24 @@ export const USE_RECIPE: string = gql`
1010 )
1111 }
1212` ;
13+
14+ export const USE_RULE_FIX : string = gql `
15+ mutation recordAccess($fingerprint: String, $ruleId: Long) {
16+ recordAccess(
17+ accessType: VsCode
18+ actionType: RuleFix
19+ ruleId: $ruleId
20+ userFingerprint: $fingerprint
21+ )
22+ }
23+ ` ;
24+
25+ export const USE_CREATE_CODIGA_YAML : string = gql `
26+ mutation recordAccess($fingerprint: String) {
27+ recordAccess(
28+ accessType: VsCode
29+ actionType: CreateCodigaYaml
30+ userFingerprint: $fingerprint
31+ )
32+ }
33+ ` ;
Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
22import { getFixesForDocument } from "../diagnostics/diagnostics" ;
3+ import { addRuleFixRecord } from "../graphql-api/add-rule-fix-record" ;
34import { RosieFix , RosieFixEdit } from "./rosieTypes" ;
45
56/**
@@ -59,6 +60,7 @@ export const applyFix = async (
5960 const workspaceEdit = new vscode . WorkspaceEdit ( ) ;
6061 workspaceEdit . set ( document . uri , edits ) ;
6162 await vscode . workspace . applyEdit ( workspaceEdit ) ;
63+ await addRuleFixRecord ( ) ;
6264} ;
6365
6466export class RosieFixAction implements vscode . CodeActionProvider {
Original file line number Diff line number Diff line change 88 INFO_MESSAGE_CODIGA_FILE_KEY ,
99 VALUE_STRING_TRUE ,
1010} from "../constants" ;
11+ import { addCreateCodigaYamlRecord } from "../graphql-api/add-create-codiga-yaml-record" ;
1112import { isRosieLanguageDetected } from "../rosie/rosieUtils" ;
1213import getFileUri , { doesFileExist } from "./fileUtils" ;
1314import { getFromLocalStorage , setToLocalStorage } from "./localStorage" ;
@@ -43,6 +44,7 @@ export async function checkCodigaFileSuggestion() {
4344 "utf-8"
4445 ) ;
4546 await vscode . workspace . fs . writeFile ( codigaUri , codigaFileContent ) ;
47+ await addCreateCodigaYamlRecord ( ) ;
4648 }
4749 }
4850 if ( selectedItem === INFO_MESSAGE_CODIGA_FILE_ACTION_IGNORE ) {
You can’t perform that action at this time.
0 commit comments