Skip to content

Commit

Permalink
Revert "Add support project setting"
Browse files Browse the repository at this point in the history
This reverts commit 76f0d44.
  • Loading branch information
adael committed Oct 18, 2021
1 parent 800af03 commit 894ec1b
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions SublimePhpCsFixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def load_settings():
return sublime.load_settings("SublimePhpCsFixer.sublime-settings")


def load_project_settings():
return sublime.active_window().active_view().settings().get('SublimePhpCsFixer')


def setting_enabled(name):
return load_settings().get(name)

Expand Down Expand Up @@ -133,22 +129,15 @@ def debug(self, msg):


class FormatterSettings:
def __init__(self, settings, project_settings):
def __init__(self, settings):
self.settings = settings
self.project_settings = project_settings
self.variables = self.get_active_window_variables()

def has(self, key):
return self.settings.has(key) or self.project_settings.get(key)

def get(self, key):
value = self.project_settings.get(key)
if value:
return value
return self.settings.get(key)

def get_expanded(self, key):
return self.expand(self.get(key))
return self.expand(self.settings.get(key))

def expand(self, value):
return sublime.expand_variables(value, self.variables)
Expand Down Expand Up @@ -315,7 +304,7 @@ class SublimePhpCsFixCommand(sublime_plugin.TextCommand):

def __init__(self, view):
sublime_plugin.TextCommand.__init__(self, view)
self.settings = FormatterSettings(load_settings(), load_project_settings())
self.settings = load_settings()
self.logger = Logger(self.settings)

def is_enabled(self):
Expand All @@ -335,7 +324,8 @@ def format(self, edit):
self.logger.console("Done. No contents")
return

formatter = ViewFormatter(self.settings, self.logger)
formatter = ViewFormatter(
FormatterSettings(self.settings), self.logger)
new_contents = formatter.format(contents)

if new_contents and new_contents != contents:
Expand Down

0 comments on commit 894ec1b

Please sign in to comment.