<commit_before>#
# Provides completion suggestions for C/C++ languages
# based on clang output
#

import sublime, sublime_plugin, os, ntpath, subprocess, codecs, re, tempfile
import os.path as path

class ClangAutoComplete(sublime_plugin.EventListener):

	compl_regex = re.compile("COMPLETION: ([^ ]+) : ([^\\n]+)")
	file_ext = re.compile("[^\.]+\.([^\\n]+)")
	syntax_regex = re.compile("\/([^\/]+)\.(?:tmLanguage|sublime-syntax)")
	project_name_regex = re.compile("([^\.]+).sublime-project")
	settings_time = 0

	def load_settings(self):
		# Only load the settings if they have changed
		settings_modified_time = path.getmtime(sublime.packages_path()+"/ClangAutoComplete/"+"ClangAutoComplete.sublime-settings")
		if (self.settings_time == settings_modified_time):
			return

		# Variable $project_base_path in settings will be replaced by sublime's project path
		settings = sublime.load_settings("ClangAutoComplete.sublime-settings")
		
		project_path=""
		if sublime.active_window().project_data() is not None \
			and sublime.active_window().project_data().get("folders") is not None \
			and sublime.active_window().project_data().get("folders")[0].get("path") is not None:
			project_path = (sublime.active_window().project_data().get("folders")[0].get("path"))
			if os.name == "nt":
				project_path = re.sub("(\\\\)", "\\\\\\\\", project_path)
		
		proj_filename = sublime.active_window().project_file_name()
		project_name=""
		if proj_filename is not None:
			res = re.findall(self.project_name_regex,ntpath.basename(sublime.active_window().project_file_name()))
			if len(res) > 0:
				project_name = res[0]

		complete_all = settings.get("autocomplete_all")
		if complete_all == "false":
			self.complete_all = False
		else:
			self.complete_all = True
		self.tmp_file_path = settings.get("tmp_file_path")<commit_msg>Add support for relative paths in project file<commit_after>#
# Provides completion suggestions for C/C++ languages
# based on clang output
#

import sublime, sublime_plugin, os, ntpath, subprocess, codecs, re, tempfile
import os.path as path

class ClangAutoComplete(sublime_plugin.EventListener):

	compl_regex = re.compile("COMPLETION: ([^ ]+) : ([^\\n]+)")
	file_ext = re.compile("[^\.]+\.([^\\n]+)")
	syntax_regex = re.compile("\/([^\/]+)\.(?:tmLanguage|sublime-syntax)")
	project_name_regex = re.compile("([^\.]+).sublime-project")
	settings_time = 0

	def load_settings(self):
		# Only load the settings if they have changed
		settings_modified_time = path.getmtime(sublime.packages_path()+"/ClangAutoComplete/"+"ClangAutoComplete.sublime-settings")
		if (self.settings_time == settings_modified_time):
			return

		# Variable $project_base_path in settings will be replaced by sublime's project path
		settings = sublime.load_settings("ClangAutoComplete.sublime-settings")
		
		project_path=""
		if sublime.active_window().project_data() is not None \
			and sublime.active_window().project_data().get("folders") is not None \
			and sublime.active_window().project_data().get("folders")[0].get("path") is not None:
			project_path = (sublime.active_window().project_data().get("folders")[0].get("path"))
			if os.name == "nt":
				project_path = re.sub("(\\\\)", "\\\\\\\\", project_path)
		
		proj_filename = sublime.active_window().project_file_name()
		project_name=""
		if proj_filename is not None:
			res = re.findall(self.project_name_regex,ntpath.basename(sublime.active_window().project_file_name()))
			if len(res) > 0:
				project_name = res[0]
			project_path = os.path.join(os.path.dirname(proj_filename), project_path)

		complete_all = settings.get("autocomplete_all")
		if complete_all == "false":
			self.complete_all = False
		else:
			self.complete_all = True
		self.tmp_file_path = settings.get("tmp_file_path")
{'fraction_non_alphanumeric': 0.15809018567639258, 'fraction_numerical': 0.002652519893899204, 'mean_word_length': 4.995230524642289, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5961942', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1253, 'n_words': 243}