mickeypearce / vscode-oracle-format

PL/SQL formatter (using SQLcl)
https://marketplace.visualstudio.com/items?itemName=mp.vscode-oracle-format
11 stars 4 forks source link

input.search is not a function #14

Closed bamontelucas closed 5 years ago

bamontelucas commented 5 years ago

Everytime I try formatting a document vscode shows me the message input.search is not a function.

image

At the "output" tab there's an [object Object] message

image

Modifying extensions.js file I was able to find out the reason and avoid the problem. It appears that the output from the sql call is being returned as an object format instead of a string.

I Made two modifications (modified version at right):

  1. image

  2. image

With these two modifications I am no longer having issues and the output is at least readable

image

mickeypearce commented 5 years ago

@bamontelucas , Thanks for reporting and fixing it. Are you willing to contribute your changes with a PR? If you are up for it, that would be awesome. :)

mickeypearce commented 5 years ago

I broke it with the latest change as I substituted execPromise:

function execPromise(cmd: string): Promise<any> {
  return new Promise(function(resolve, reject) {
    exec(cmd, (error, stdout, stderr) => {
      if (error) {
        reject(error);
      }
      resolve(stdout);
    });
  });
}

with const execPromise = util.promisify(exec);

of course stdout and error are not handlet properly as promise returns an object now. :(

mickeypearce commented 5 years ago

Released in v0.1.3. Thanks @bamontelucas .