equal
deleted
inserted
replaced
228 val markdown_elements = |
228 val markdown_elements = |
229 Markup.Elements(Markup.MARKDOWN_PARAGRAPH, Markup.MARKDOWN_ITEM, Markup.Markdown_List.name, |
229 Markup.Elements(Markup.MARKDOWN_PARAGRAPH, Markup.MARKDOWN_ITEM, Markup.Markdown_List.name, |
230 Markup.Markdown_Bullet.name) |
230 Markup.Markdown_Bullet.name) |
231 } |
231 } |
232 |
232 |
233 abstract class Rendering( |
233 class Rendering( |
234 val snapshot: Document.Snapshot, |
234 val snapshot: Document.Snapshot, |
235 val options: Options, |
235 val options: Options, |
236 val session: Session) |
236 val session: Session) |
237 { |
237 { |
238 override def toString: String = "Rendering(" + snapshot.toString + ")" |
238 override def toString: String = "Rendering(" + snapshot.toString + ")" |
239 |
239 |
240 def model: Document.Model |
240 def get_text(range: Text.Range): Option[String] = None |
241 |
241 |
242 |
242 |
243 /* caret */ |
243 /* caret */ |
244 |
244 |
245 def before_caret_range(caret: Text.Offset): Text.Range = |
245 def before_caret_range(caret: Text.Offset): Text.Range = |
273 caret_range: Text.Range): (Boolean, Option[Completion.Result]) = |
273 caret_range: Text.Range): (Boolean, Option[Completion.Result]) = |
274 { |
274 { |
275 semantic_completion(completed_range, caret_range) match { |
275 semantic_completion(completed_range, caret_range) match { |
276 case Some(Text.Info(_, Completion.No_Completion)) => (true, None) |
276 case Some(Text.Info(_, Completion.No_Completion)) => (true, None) |
277 case Some(Text.Info(range, names: Completion.Names)) => |
277 case Some(Text.Info(range, names: Completion.Names)) => |
278 model.get_text(range) match { |
278 get_text(range) match { |
279 case Some(original) => (false, names.complete(range, history, unicode, original)) |
279 case Some(original) => (false, names.complete(range, history, unicode, original)) |
280 case None => (false, None) |
280 case None => (false, None) |
281 } |
281 } |
282 case None => (false, None) |
282 case None => (false, None) |
283 } |
283 } |
356 s.startsWith("\"") && s.endsWith("\"") || |
356 s.startsWith("\"") && s.endsWith("\"") || |
357 s.startsWith(Symbol.open_decoded) && s.endsWith(Symbol.close_decoded) |
357 s.startsWith(Symbol.open_decoded) && s.endsWith(Symbol.close_decoded) |
358 |
358 |
359 for { |
359 for { |
360 Text.Info(r1, delimited) <- language_path(before_caret_range(caret)) |
360 Text.Info(r1, delimited) <- language_path(before_caret_range(caret)) |
361 s1 <- model.get_text(r1) |
361 s1 <- get_text(r1) |
362 (r2, s2) <- |
362 (r2, s2) <- |
363 if (is_wrapped(s1)) { |
363 if (is_wrapped(s1)) { |
364 Some((Text.Range(r1.start + 1, r1.stop - 1), s1.substring(1, s1.length - 1))) |
364 Some((Text.Range(r1.start + 1, r1.stop - 1), s1.substring(1, s1.length - 1))) |
365 } |
365 } |
366 else if (delimited) Some((r1, s1)) |
366 else if (delimited) Some((r1, s1)) |