[gnome-code-assistance/wip/arch] [backends/ruby] Fix for new architecture
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-code-assistance/wip/arch] [backends/ruby] Fix for new architecture
- Date: Mon, 11 Nov 2013 10:44:11 +0000 (UTC)
commit d2721c4103846c0cca49897c3dda39d1e8f97801
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Mon Nov 11 11:40:27 2013 +0100
[backends/ruby] Fix for new architecture
backends/ruby/app.rb | 58 +++++++++++++++++++------------------------------
1 files changed, 23 insertions(+), 35 deletions(-)
---
diff --git a/backends/ruby/app.rb b/backends/ruby/app.rb
index a146203..602fee9 100644
--- a/backends/ruby/app.rb
+++ b/backends/ruby/app.rb
@@ -18,51 +18,39 @@
require 'gnome/codeassistance/transport'
require 'gnome/codeassistance/ruby/parser'
-module Gnome::CodeAssistance::Ruby
- class Service < Gnome::CodeAssistance::Service
- @language = 'ruby'
+module Gnome::CodeAssistance
+ module Ruby
+ class Service < Service
+ @@language = 'ruby'
- def parse(path, cursor, unsaved, options, doc)
- dp = data_path(path, unsaved)
+ def parse(doc, options)
+ doc.diagnostics = []
- f = File.new(dp, 'r')
+ f = File.new(doc.data_path, 'r')
- if doc == nil
- doc = new_document
- end
+ begin
+ Parser.parse(f, doc.path)
+ rescue Parser::ParseError => e
+ doc.diagnostics = e.errors.collect { |e| make_diagnostic(e) }
+ end
- begin
- Parser.parse(f, path)
- rescue Parser::ParseError => e
- doc.errors = e.errors.collect { |e| make_diagnostic(e) }
+ f.close
end
- return doc
- end
-
- def make_diagnostic(e)
- loc = Gnome::CodeAssistance::SourceLocation.new(e.line, e.column)
- Gnome::CodeAssistance::Diagnostic.new(Gnome::CodeAssistance::Diagnostic::Severity::ERROR, [],
[loc.to_range], e.message)
- end
- end
-
- class Document < Gnome::CodeAssistance::Document
- extend Gnome::CodeAssistance::Services::Diagnostics
-
- attr_accessor :errors
-
- def initialize
- @errors = []
+ def make_diagnostic(e)
+ loc = SourceLocation.new(e.line, e.column)
+ Diagnostic.new(Diagnostic::Severity::ERROR, [], [loc.to_range], e.message)
+ end
end
- def diagnostics
- @errors
+ class Document < Document
+ include Services::Diagnostics
end
- end
- class Application
- def self.run()
- Gnome::CodeAssistance::Transport.new(Service, Document).run()
+ class Application
+ def self.run()
+ Transport.new(Service, Document).run()
+ end
end
end
end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]