Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source date handler improvement #824

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
811881f
Add parser into source length check
worksofliam Aug 20, 2022
1ce4778
Source dates now calculated by diff
worksofliam Aug 20, 2022
cec0cd7
Store new dates on save
worksofliam Aug 20, 2022
8efd857
Handle new lines
worksofliam Aug 20, 2022
e88b2f1
Only refresh on dirty files
worksofliam Aug 20, 2022
8ae71e3
Useful hover text
worksofliam Aug 20, 2022
7803537
Ability to filter lines by source date
worksofliam Aug 20, 2022
c07eba0
Command to apply source date filter
worksofliam Aug 20, 2022
9a42de1
Updated docs about source date functionality
worksofliam Aug 21, 2022
c80254f
Fix handler
worksofliam Aug 22, 2022
aec2d32
Use document instead of editor
worksofliam Aug 22, 2022
63df990
Merge branch 'cleanup/sourcedates' of github.com:halcyon-tech/vscode-…
worksofliam Aug 22, 2022
d28b50d
Always refresh if a new line is added
worksofliam Aug 26, 2022
728483e
Merge branch 'master' into cleanup/sourcedates
worksofliam Aug 26, 2022
1d92617
Fix lint issues
worksofliam Aug 26, 2022
ad3ede5
Merge branch 'master' into cleanup/sourcedates
worksofliam Aug 26, 2022
b05eee7
Fix more lint rules
worksofliam Aug 26, 2022
c23145c
Fix to issue when editing top of file
worksofliam Aug 26, 2022
db3e109
Fix to refresh when editing first column
worksofliam Aug 26, 2022
d9f9e87
Fix bug due to date values being in wrong order
worksofliam Aug 26, 2022
fcad7e2
Date range highlight support
worksofliam Aug 26, 2022
ce7eafb
Cleanup to date change algorithm
worksofliam Aug 26, 2022
4b617a7
Remove line hover message
worksofliam Aug 26, 2022
fb5b306
Fix for vert start of document
worksofliam Aug 27, 2022
a2d727d
Re-write source date change algorithm
worksofliam Aug 30, 2022
02f0868
Change wording and number test
worksofliam Aug 30, 2022
7abda06
Improved refresh logic
worksofliam Aug 31, 2022
4a506ce
Change to lines added
worksofliam Sep 1, 2022
b8c5494
Merge branch 'master' into cleanup/sourcedates
worksofliam Sep 1, 2022
7856e62
Correct index for deleted lines
worksofliam Sep 1, 2022
b592c4e
Improve performance
worksofliam Sep 2, 2022
4581933
Trigger build
worksofliam Sep 2, 2022
73602bf
Merge branch 'master' into cleanup/sourcedates
worksofliam Nov 3, 2022
5c19552
Bring additional changes
worksofliam Nov 3, 2022
7bda55c
Casing fix
worksofliam Nov 3, 2022
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
15 changes: 13 additions & 2 deletions package-lock.json

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

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,11 @@
"title": "Upload and replace",
"category": "IBM i"
},
{
"command": "code-for-ibmi.member.newDateSearch",
"title": "Apply Source Date Filter",
"category": "IBM i"
},
{
"command": "code-for-ibmi.refreshIFSBrowser",
"title": "Refresh IFS List",
Expand Down Expand Up @@ -1734,6 +1739,7 @@
"node-ssh": "^11.1.1",
"source-map-support": "^0.5.21",
"tmp": "^0.2.1",
"vscode-diff": "^2.0.2",
"xml2js": "^0.4.23"
},
"extensionDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion src/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import path from 'path';

const CompileTools = require(`./api/CompileTools`);

import {Terminal} from './api/terminal';
import {Terminal} from './api/Terminal';
const Deployment = require(`./api/Deployment`);

import { CustomUI, Field } from './api/CustomUI';
Expand Down
8 changes: 1 addition & 7 deletions src/api/IBMi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,7 @@ export default class IBMi {
}

async sendQsh(options: CommandData) {
let qshCommand;

if (Array.isArray(options.command)) {
qshCommand = options.command.join(`;`);
} else {
qshCommand = options.command;
}
const qshCommand = options.command;

options.stdin = qshCommand;

Expand Down
2 changes: 1 addition & 1 deletion src/api/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export namespace Terminal {
}
},
setDimensions: (dim: vscode.TerminalDimensions) => {
channel.setWindow(dim.rows, dim.columns, `500`, `500`);
channel.setWindow(String(dim.rows), dim.columns, `500`, `500`);
},
},
});
Expand Down
19 changes: 12 additions & 7 deletions src/filesystems/qsys/complex/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tmpFile = util.promisify(tmp.file);
const writeFileAsync = util.promisify(fs.writeFile);

const DEFAULT_RECORD_LENGTH = 80;
let { allSourceDates, recordLengths, getAliasName } = require(`./data`);
const Handler = require(`./handler`);
let { baseSource, recordLengths, getAliasName, baseDates } = require(`./data`);

module.exports = class IBMiContent {
/**
Expand Down Expand Up @@ -39,11 +40,11 @@ module.exports = class IBMiContent {
if (recordLengths[alias] === undefined) {
const result = await content.runSQL(`SELECT LENGTH(srcdta) as LENGTH FROM ${aliasPath} limit 1`);
if (result.length > 0) {
recordLengths[alias] = result[0].LENGTH;
recordLengths[alias] = Number(result[0].LENGTH);
} else {
const result = await content.runSQL(`SELECT row_length-12 as LENGTH FROM QSYS2.SYSTABLES WHERE TABLE_SCHEMA = '${lib}' and TABLE_NAME = '${spf}' limit 1`);
if (result.length > 0) {
recordLengths[alias] = result[0].LENGTH;
recordLengths[alias] = Number(result[0].LENGTH);
} else {
recordLengths[alias] = DEFAULT_RECORD_LENGTH;
}
Expand All @@ -66,7 +67,8 @@ module.exports = class IBMiContent {
.map(row => row.SRCDTA)
.join(`\n`);

allSourceDates[alias] = sourceDates;
baseDates[alias] = sourceDates;
baseSource[alias] = body;

return body;

Expand All @@ -87,7 +89,6 @@ module.exports = class IBMiContent {
const tempLib = connection.config.tempLibrary;
const alias = getAliasName(lib, spf, mbr);
const aliasPath = `${tempLib}.${alias}`;
const sourceDates = allSourceDates[alias];

const client = connection.client;
const tempRmt = connection.getTempRemote(lib + spf + mbr);
Expand All @@ -98,6 +99,8 @@ module.exports = class IBMiContent {

const decimalSequence = sourceData.length >= 10000;

const newDates = Handler.calcNewSourceDates(alias, body);

let rows = [],
sequence = 0;
for (let i = 0; i < sourceData.length; i++) {
Expand All @@ -107,7 +110,7 @@ module.exports = class IBMiContent {
}

rows.push(
`(${sequence}, ${sourceDates[i] ? sourceDates[i].padEnd(6, `0`) : `0`}, '${this.escapeString(sourceData[i])}')`,
`(${sequence}, ${newDates[i] ? newDates[i].padEnd(6, `0`) : `0`}, '${this.escapeString(sourceData[i])}')`,
);
}

Expand All @@ -127,7 +130,9 @@ module.exports = class IBMiContent {
await connection.remoteCommand(
`QSYS/RUNSQLSTM SRCSTMF('${tempRmt}') COMMIT(*NONE) NAMING(*SQL)`,
);


baseSource[alias] = body;
baseDates[alias] = newDates;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/filesystems/qsys/complex/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ module.exports = {
},

/** @type {{[path: string]: string[]}} */
allSourceDates: {},
baseDates: {},

/** @type {{[path: string]: string}} */
baseSource: {},

/** @type {{[path: string]: number}} */
recordLengths: {},
recordLengths: {}
};
Loading