Skip to content
Open
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"antlr4": "4.7.2",
"bootstrap": "4.4.1",
"chroma-js": "2.1.0",
"diff": "4.0.2",
"diff": "^4.0.2",
"diff2html": "^3.4.48",
"elementtree": "0.1.7",
"marked": "4.0.12",
"monaco-editor": "0.21.2",
Expand All @@ -16,6 +17,7 @@
"openai": "^4.30.0",
"path": "0.12.7",
"pluralize": "7.0.0",
"prismjs": "^1.29.0",
"rc-slider": "8.7.1",
"rc-tooltip": "4.0.0-alpha.3",
"react": "16.12.0",
Expand Down
345 changes: 309 additions & 36 deletions src/activeLLM/suggestFix.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/core/ActiveLLM.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"folders": [
{
"path": "../../.."
}
]
}
4 changes: 4 additions & 0 deletions src/core/coreConstants.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
export const webSocketSendMessage = {
send_info_for_edit_fix:"SEND_INFO_FOR_EDIT_FIX",
modified_rule_msg: "MODIFIED_RULE",
modified_tag_msg: "MODIFIED_TAG",
snippet_xml_msg: "XML_RESULT",
llm_modified_file_content: "LLM_MODIFIED_FILE_CONTENT",
converted_java_snippet_msg: "CONVERTED_JAVA_SNIPPET",
code_to_xml_msg: "EXPR_STMT",
new_rule_msg: "NEW_RULE",
new_tag_msg: "NEW_TAG",
send_llm_snippet_msg: "LLM_SNIPPET",

open_file_msg: "OPEN_FILE",

Expand All @@ -18,6 +21,7 @@ export const webSocketSendMessage = {
};

export const webSocketReceiveMessage = {
receive_content_for_edit_fix: "RECEIVE_CONTENT_FOR_EDIT_FIX",
xml_files_msg: "XML",
rule_table_msg: "RULE_TABLE",
tag_table_msg: "TAG_TABLE",
Expand Down
36 changes: 35 additions & 1 deletion src/core/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ class Utilities {
tagInfo: data
};
break;

case webSocketSendMessage.send_llm_snippet_msg:
console.log("In command");
console.log(data);
messageJson.data={
code:data.suggestedSnippet,
explanation:data.snippetExplanation
}
break;

case webSocketSendMessage.send_info_for_edit_fix:
messageJson.data={
filePathOfSuggestedFix:data.data.fileToChange,
filePathOfViolation:data.data.filePath,
modifiedFileContent:data.data.modifiedFileContent
}
break;


case webSocketSendMessage.llm_modified_file_content:
if (!data.llmModifiedFileContent) {
console.warn('No LLM modified file content to send.');
return;
}

messageJson.data = {
filePath: data.llmModifiedFileContent.data.filePath,
explanation: data.llmModifiedFileContent.data.explanation,
fileToChange: data.llmModifiedFileContent.data.fileToChange,
modifiedFileContent: data.llmModifiedFileContent.data.modifiedFileContent,
originalFileContent: data.originalFileContent || data.llmModifiedFileContent.data.originalFileContent || '',
}

break;
case webSocketSendMessage.snippet_xml_msg:
messageJson.data = {
fileName: data.fileName,
Expand Down Expand Up @@ -246,4 +280,4 @@ class Utilities {

}

export default Utilities;
export default Utilities;
28 changes: 19 additions & 9 deletions src/core/webSocketManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import {Component} from "react";
import {connect} from "react-redux";


import {
receiveExpressionStatementXML,
ignoreFileChange, updateFilePath,
Expand Down Expand Up @@ -51,6 +52,7 @@ class WebSocketManager extends Component {

switch (message.command) {


case webSocketReceiveMessage.enter_chat_msg:
this.props.onLoadingGif(true);
break;
Expand Down Expand Up @@ -170,17 +172,25 @@ class WebSocketManager extends Component {

case webSocketReceiveMessage.file_change_in_ide_msg:
// data: "filePath"

let focusedFilePath = message.data;
if (!this.props.ignoreFileChange) {
this.props.onFilePathChange(focusedFilePath);
window.location.hash = `#/${hashConst.rulesForFile}/` + focusedFilePath.replace(/\//g, "%2F");
} else {
counter--;
if (counter === 0) {
this.props.onFalsifyIgnoreFile();
counter = 3;
}
console.log("File name: ");
console.log(focusedFilePath);
focusedFilePath = String(focusedFilePath);

if(!focusedFilePath.includes("edit_fix_window")){
if (!this.props.ignoreFileChange) {
this.props.onFilePathChange(focusedFilePath);
window.location.hash = `#/${hashConst.rulesForFile}/` + focusedFilePath.replace(/\//g, "%2F");
} else {
counter--;
if (counter === 0) {
this.props.onFalsifyIgnoreFile();
counter = 3;
}
}
}

break;

/* Mining Rules */
Expand Down
168 changes: 168 additions & 0 deletions src/prism-vs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/**
* VS theme by Andrew Lock (https://andrewlock.net)
* Inspired by Visual Studio syntax coloring
*/

code[class*="language-"],
pre[class*="language-"] {
color: #393A34;
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
font-size: .9em;
line-height: 1.2em;

-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;

-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}

pre > code[class*="language-"] {
font-size: 1em;
}

pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
background: #C1DEF1;
}

pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
background: #C1DEF1;
}

/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
border: 1px solid #dddddd;
background-color: white;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .2em;
padding-top: 1px;
padding-bottom: 1px;
background: #f8f8f8;
border: 1px solid #dddddd;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #008000;
font-style: italic;
}

.token.namespace {
opacity: .7;
}

.token.string {
color: #A31515;
}

.token.punctuation,
.token.operator {
color: #393A34; /* no highlight */
}

.token.url,
.token.symbol,
.token.number,
.token.boolean,
.token.variable,
.token.constant,
.token.inserted {
color: #36acaa;
}

.token.atrule,
.token.keyword,
.token.attr-value,
.language-autohotkey .token.selector,
.language-json .token.boolean,
.language-json .token.number,
code[class*="language-css"] {
color: #0000ff;
}

.token.function {
color: #393A34;
}

.token.deleted,
.language-autohotkey .token.tag {
color: #9a050f;
}

.token.selector,
.language-autohotkey .token.keyword {
color: #00009f;
}

.token.important {
color: #e90;
}

.token.important,
.token.bold {
font-weight: bold;
}

.token.italic {
font-style: italic;
}

.token.class-name,
.language-json .token.property {
color: #2B91AF;
}

.token.tag,
.token.selector {
color: #800000;
}

.token.attr-name,
.token.property,
.token.regex,
.token.entity {
color: #ff0000;
}

.token.directive.tag .tag {
background: #ffff00;
color: #393A34;
}

/* overrides color-values for the Line Numbers plugin
* http://prismjs.com/plugins/line-numbers/
*/
.line-numbers.line-numbers .line-numbers-rows {
border-right-color: #a5a5a5;
}

.line-numbers .line-numbers-rows > span:before {
color: #2B91AF;
}

/* overrides color-values for the Line Highlight plugin
* http://prismjs.com/plugins/line-highlight/
*/
.line-highlight.line-highlight {
background: rgba(193, 222, 241, 0.2);
background: -webkit-linear-gradient(left, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0));
background: linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0));
}
Loading