1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
module LanguageServer
module Protocol
module Interface
#
# Params to show a resource.
#
class ShowDocumentParams
def initialize(uri:, external: nil, take_focus: nil, selection: nil)
@attributes = {}
@attributes[:uri] = uri
@attributes[:external] = external if external
@attributes[:takeFocus] = take_focus if take_focus
@attributes[:selection] = selection if selection
@attributes.freeze
end
#
# The uri to show.
#
# @return [string]
def uri
attributes.fetch(:uri)
end
#
# Indicates to show the resource in an external program.
# To show, for example, `https://code.visualstudio.com/`
# in the default WEB browser set `external` to `true`.
#
# @return [boolean]
def external
attributes.fetch(:external)
end
#
# An optional property to indicate whether the editor
# showing the document should take focus or not.
# Clients might ignore this property if an external
# program is started.
#
# @return [boolean]
def take_focus
attributes.fetch(:takeFocus)
end
#
# An optional selection range if the document is a text
# document. Clients might ignore the property if an
# external program is started or the file is not a text
# file.
#
# @return [Range]
def selection
attributes.fetch(:selection)
end
attr_reader :attributes
def to_hash
attributes
end
def to_json(*args)
to_hash.to_json(*args)
end
end
end
end
end
|