<commit_before>fs = require('fs')
tagRegExp =  /(<([^>]+)>)/ig
util = require './ti-pkg-util'
related = require './related'
_ = require 'underscore'
find = require 'find'
path = require 'path'
parseString = require('xml2js').parseString;
getLine = util.getLine
find = require 'find'

module.exports = {
  cfg: {
    regExp : /Alloy\.CFG\.([-a-zA-Z0-9-_\/]*)$/
    getCompletions : (request) ->
      completions = undefined
      line = getLine(request)
      
      if @regExp.test(line)
        cfgPath = path.join(util.getAlloyRootPath(),'config.json')
        cfgKeys = []
        completions = []
        if util.isExistAsFile cfgPath
          try
            cfgObj = JSON.parse(util.getFileEditor(cfgPath).getText())
            allKeys = util.getAllKeys(cfgObj.global)<commit_msg>#45 improve Alloy.CFG complition<commit_after>fs = require('fs')
tagRegExp =  /(<([^>]+)>)/ig
util = require './ti-pkg-util'
related = require './related'
_ = require 'underscore'
find = require 'find'
path = require 'path'
parseString = require('xml2js').parseString;
getLine = util.getLine
find = require 'find'

module.exports = {
  cfg: {
    regExp : /Alloy\.CFG\.([-a-zA-Z0-9-_\/]*)$/
    getCompletions : (request) ->
      completions = undefined
      line = getLine(request)
      
      if @regExp.test(line)
        cfgPath = path.join(util.getAlloyRootPath(),'config.json')
        cfgKeys = []
        completions = []
        if util.isExistAsFile cfgPath
          try
            # merge ally evn and platform(os) keys
            cfgObj = JSON.parse(util.getFileEditor(cfgPath).getText())
            cfgObj = _.reduce(cfgObj, (memo, value, key) ->
              if key is "global" or key.startsWith('env:') or key.startsWith('os:')
                return _.extend(memo,value)
              else
                return memo;
            , {})
            
            allKeys = util.getAllKeys(cfgObj)
            
{'fraction_non_alphanumeric': 0.1504424778761062, 'fraction_numerical': 0.004164497657470068, 'mean_word_length': 2.291095890410959, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '948171', 'n_tokens_mistral': 627, 'n_tokens_neox': 614, 'n_words': 124}