aerhard / linter-autocomplete-jing

Jing-based autocomplete and validation of XML documents in Atom
https://atom.io/packages/linter-autocomplete-jing
MIT License
19 stars 3 forks source link

Still working on Atom 1.32.x? #55

Closed pgundlach closed 5 years ago

pgundlach commented 5 years ago

I have a package built on top of your linter-autocomplete-jing package and my package has stopped working on Atom 1.32.2 (https://github.com/speedata/atom-schema-speedata/issues/5). Now I assume an error on my side or some changes in Atom, so I'd like to ask if you have heard of similar issues which could help me tracing the problem. BTW: is there an easy way to test your package?

iclukas commented 5 years ago

I can confirm that autocomplete is broken starting with Atom 1.32.0. No errors, no console messages. I tried SVG from xml-common-schemata.

pgundlach commented 5 years ago

I have been digging further: when I change updateRules() in main.js, I get the desired result:

const updateRules = () => {
  const activePackages = atom.packages.getActivePackages();
  const rules = flow(
    flatMap('settings'),
    flatMap(({ path: settingsPath, properties }) =>
      flow(
        get(['.text.xml', 'validation', 'rules']),
        map(({ test, outcome }) => ({ test, outcome, settingsPath })),
      )(properties),
    ),
    compact,
  )(activePackages);
  ruleManager.updatePackageRules(rules);
};

In Atom 1.3.2 the array atom.packages.getActivePackages() has changed its format. See the screen shots:

1.31:

1-31

and 1.32:

1-32

Not sure if this (above) is the best code, but at least it works with the current Atom.

@aerhard Would it be possible to update this package?

aerhard commented 5 years ago

Thanks a lot for investigating, @pgundlach! I'll update the package over the weekend

pgundlach commented 5 years ago

Beware that I am not an expert in Javascript nor Atom programming (exactly the opposite). So while the above solution works for me, I don't know if there is a better way.

aerhard commented 5 years ago

That issue did occur because one of the commits for Atom v1.32 changed the structure of 'setting' objects (https://github.com/atom/atom/commit/231cc58e006779169c6a34b1d6c5ac26ec18882c) -- your adjustment is exactly at the right place, where we read these objects. In addition to your changes, I've made a small adjustment to maintain compatibility with older Atom versions (https://github.com/aerhard/linter-autocomplete-jing/pull/56/files#diff-1c90ff38a08209f9ebd4d05d1e43358eR95).

pgundlach commented 5 years ago

Since version 0.8.3 works fine with Atom 1.32.0, I'd like to close this issue with a very big 'thank you'.