Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Feb 12, 2024
1 parent 33454bb commit d1e1249
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 85 deletions.
2 changes: 1 addition & 1 deletion client/src/browserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,5 +710,5 @@ async function updateMetaStore(content: any, workspaceRootUri: vscode.Uri): Prom
// }
// }

client.sendNotification("update-meta-store", [subgraphs, metas, deployers]);
client.sendNotification("update-meta-store", [subgraphs]);
}
2 changes: 1 addition & 1 deletion client/src/nodeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,5 +766,5 @@ async function updateMetaStore(content: any, workspaceRootUri: vscode.Uri): Prom
// }
// }

client.sendNotification("update-meta-store", [subgraphs, metas, deployers]);
client.sendNotification("update-meta-store", [subgraphs]);
}
12 changes: 6 additions & 6 deletions server/package-lock.json

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

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/rainprotocol/rainlang-vscode/issues"
},
"dependencies": {
"@rainlanguage/dotrain": "file:../../rainlang/rainlanguage-dotrain-5.1.6.tgz",
"@rainlanguage/dotrain": "file:../../dotrain/rainlanguage-dotrain-6.0.0.tgz",
"vscode-languageserver": "^8.1.0",
"vscode-languageserver-textdocument": "^1.0.11"
},
Expand Down
42 changes: 4 additions & 38 deletions server/src/browserServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
RainDocument,
TextDocumentItem,
RainLanguageServices,
DeployerQueryResponse,
getDeployedBytecodeMetaHash
// DeployerQueryResponse,
// getDeployedBytecodeMetaHash
} from "@rainlanguage/dotrain";
import {
TextEdit,
Expand Down Expand Up @@ -116,40 +116,6 @@ connection.onInitialized(() => {
// update meta store when config has changed and revalidate documents
connection.onNotification("update-meta-store", async e => {
try {
for (const d of e[1]) {
try {
if (typeof d === "string") {
const data = arrayify(d);
metaStore.updateWith(keccak256(data), data);
} else {
metaStore.updateWith(keccak256(d), d);
}
}
catch { /**/ }
}
for (let i = 0; i < e[2].length; i++) {
try {
const deployerDetails = e[2][i];
let metaBytes;
if (typeof deployerDetails[1] === "string") {
metaBytes = arrayify(deployerDetails[1]);
} else {
metaBytes = deployerDetails[0];
}
const deployer: DeployerQueryResponse = {
txHash: arrayify(deployerDetails[0]),
bytecodeMetaHash: getDeployedBytecodeMetaHash(deployerDetails[3]),
metaHash: keccak256(metaBytes),
metaBytes,
bytecode: arrayify(deployerDetails[2]),
parser: arrayify(deployerDetails[4]),
store: arrayify(deployerDetails[5]),
interpreter: arrayify(deployerDetails[6])
};
metaStore.setDeployer(deployer);
}
catch { /**/ }
}
metaStore.addSubgraphs(e[0]);
// documents.all().forEach(v => validate(v, v.getText(), v.version));
}
Expand Down Expand Up @@ -186,7 +152,7 @@ connection.onExecuteCommand(async e => {
else _td = uriOrFile;
if (_td) {
try {
return await RainDocument.compileTextAsync(_td, expKeys, metaStore);
return await RainDocument.composeTextAsync(_td, expKeys, metaStore);
}
catch (err) {
return err;
Expand Down Expand Up @@ -328,7 +294,7 @@ async function validate(uri: string, text: string, version: number, languageId:

async function setHashMap(text: string, uri: string) {
const _td = TextDocument.create(uri, "rainlang", 0, text);
const _rd = RainDocument.create(text, uri, metaStore);
const _rd = RainDocument.create(text, metaStore);
hashMap.set(
uri,
_rd.imports.map(v => ({
Expand Down
42 changes: 4 additions & 38 deletions server/src/nodeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
RainDocument,
TextDocumentItem,
RainLanguageServices,
DeployerQueryResponse,
getDeployedBytecodeMetaHash
// DeployerQueryResponse,
// getDeployedBytecodeMetaHash
} from "@rainlanguage/dotrain";
import {
TextEdit,
Expand Down Expand Up @@ -102,40 +102,6 @@ connection.onInitialized(() => {
// update meta store when config has changed and revalidate documents
connection.onNotification("update-meta-store", async e => {
try {
for (const d of e[1]) {
try {
if (typeof d === "string") {
const data = arrayify(d);
metaStore.updateWith(keccak256(data), data);
} else {
metaStore.updateWith(keccak256(d), d);
}
}
catch { /**/ }
}
for (let i = 0; i < e[2].length; i++) {
try {
const deployerDetails = e[2][i];
let metaBytes;
if (typeof deployerDetails[1] === "string") {
metaBytes = arrayify(deployerDetails[1]);
} else {
metaBytes = deployerDetails[0];
}
const deployer: DeployerQueryResponse = {
txHash: arrayify(deployerDetails[0]),
bytecodeMetaHash: getDeployedBytecodeMetaHash(deployerDetails[3]),
metaHash: keccak256(metaBytes),
metaBytes,
bytecode: arrayify(deployerDetails[2]),
parser: arrayify(deployerDetails[4]),
store: arrayify(deployerDetails[5]),
interpreter: arrayify(deployerDetails[6])
};
metaStore.setDeployer(deployer);
}
catch { /**/ }
}
metaStore.addSubgraphs(e[0]);
// documents.all().forEach(v => validate(v, v.getText(), v.version));
}
Expand Down Expand Up @@ -172,7 +138,7 @@ connection.onExecuteCommand(async e => {
else _td = uriOrFile;
if (_td) {
try {
return await RainDocument.compileTextAsync(_td, expKeys, metaStore);
return await RainDocument.composeTextAsync(_td, expKeys, metaStore);
}
catch (err) {
return err;
Expand Down Expand Up @@ -347,7 +313,7 @@ async function validate(uri: string, text: string, version: number, languageId:

async function setHashMap(text: string, uri: string) {
const _td = TextDocument.create(uri, "rainlang", 0, text);
const _rd = RainDocument.create(text, uri, metaStore);
const _rd = RainDocument.create(text, metaStore);
hashMap.set(
uri,
_rd.imports.map(v => ({
Expand Down

0 comments on commit d1e1249

Please sign in to comment.