message: Load data/packages/class-*.json files to provide completion items
  specific to documentclasses.
diff: @@ -217,8 +217,37 @@ export class Command {
  updatePkg(file: string, nodes?: latexParser.Node[], content?: string) {
  if (nodes !== undefined) {
  + this.updatePkgWithNodeArray(file, nodes)
  + } else if (content !== undefined) {
  + const pkgReg = /\\usepackage(?:\[[^[\]{}]*\])?{(.*)}/g
  + const pkgs: string[] = []
  +
  + if (this.extension.manager.cachedContent[file].element.package === undefined) {
  + this.extension.manager.cachedContent[file].element.package = []
  + }
  +
  + while (true) {
  + const result = pkgReg.exec(content)
  + if (result === null) {
  + break
  + }
  + result[1].split(',').forEach(pkg => {
  + pkg = pkg.trim()
  + if (pkgs.includes(pkg)) {
  + return
  + }
  + const filePkgs = this.extension.manager.cachedContent[file].element.package
  + if (filePkgs !== undefined) {
  + filePkgs.push(pkg)
  + }
  + })
  + }
  + }
  + }
  +
  + updatePkgWithNodeArray(file: string, nodes: latexParser.Node[]) {
  nodes.forEach(node => {
  - if (latexParser.isCommand(node) && node.name === 'usepackage') {
  + if ( latexParser.isCommand(node) && (node.name === 'usepackage' || node.name === 'documentclass') ) {
  node.args.forEach(arg => {
  if (latexParser.isOptionalArg(arg)) {
  return
  @@ -232,6 +261,9 @@ export class Command {
  if (pkg === '') {
  return
  }
  + if (node.name === 'documentclass') {
  + pkg = 'class-' + pkg
  + }
  const pkgs = this.extension.manager.cachedContent[file].element.package
  if (pkgs) {
  pkgs.push(pkg)
  @@ -243,36 +275,11 @@ export class Command {
  })
  } else {
  if (latexParser.hasContentArray(node)) {
  - this.updatePkg(file, node.content)
  - }
  - }
  - })
  - } else if (content !== undefined) {
  - const pkgReg = /\\usepackage(?:\[[^[\]{}]*\])?{(.*)}/g
  - const pkgs: string[] = []
  -
  - if (this.extension.manager.cachedContent[file].element.package === undefined) {
  - this.extension.manager.cachedContent[file].element.package = []
  - }
  -
  - while (true) {
  - const result = pkgReg.exec(content)
  - if (result === null) {
  - break
  + this.updatePkgWithNodeArray(file, node.content)
  }
  - result[1].split(',').forEach(pkg => {
  - pkg = pkg.trim()
  - if (pkgs.includes(pkg)) {
  - return
  - }
  - const filePkgs = this.extension.manager.cachedContent[file].element.package
  - if (filePkgs !== undefined) {
  - filePkgs.push(pkg)
  }
  })
  }
  - }
  - }
  private getCmdFromNode(file: string, node: latexParser.Node, cmdList: string[] = []): Suggestion[] {
  const cmds: Suggestion[] = []
  