From 600089413bfea3b68b98d68975ab53347b169e1f Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 29 Nov 2007 00:22:05 +0000 Subject: [PATCH] fixed auto completion in the REPL and improved the tools manual a little svn: r7855 --- collects/drscheme/drscheme.scrbl | 9 +++ collects/drscheme/info.ss | 3 +- .../private/language-configuration.ss | 13 +---- collects/drscheme/tools.scrbl | 58 +++++++++---------- collects/framework/framework.scrbl | 9 +++ collects/framework/info.ss | 3 +- collects/framework/private/color.ss | 1 + collects/framework/private/scheme.ss | 20 ++++--- 8 files changed, 65 insertions(+), 51 deletions(-) create mode 100644 collects/drscheme/drscheme.scrbl create mode 100644 collects/framework/framework.scrbl diff --git a/collects/drscheme/drscheme.scrbl b/collects/drscheme/drscheme.scrbl new file mode 100644 index 0000000000..85fb6d55c7 --- /dev/null +++ b/collects/drscheme/drscheme.scrbl @@ -0,0 +1,9 @@ +#lang scribble/doc + +@begin[ +(require scribble/manual) +] + +@title{PLT DrScheme: Programming Environment Manual} + +Nothing yet. diff --git a/collects/drscheme/info.ss b/collects/drscheme/info.ss index 3b9c47f17a..b69cab20c0 100644 --- a/collects/drscheme/info.ss +++ b/collects/drscheme/info.ss @@ -4,5 +4,6 @@ (define tool-names (list "Check Syntax" "Time Keystrokes")) (define mred-launcher-names (list "DrScheme")) (define mred-launcher-libraries (list "drscheme.ss")) - (define scribblings '(("tools.scrbl" (multi-page main-doc))))) + (define scribblings '(("tools.scrbl" (multi-page main-doc)) + ("drscheme.scrbl" (#;multi-page main-doc))))) diff --git a/collects/drscheme/private/language-configuration.ss b/collects/drscheme/private/language-configuration.ss index bfa91e2755..a19c346b63 100644 --- a/collects/drscheme/private/language-configuration.ss +++ b/collects/drscheme/private/language-configuration.ss @@ -1333,18 +1333,7 @@ (let ([words #f]) (λ () (unless words - (set! words (text:get-completions/manuals - (list "gui" - "guide" - "help" - "mzscheme" - "mred" - "quick" - "r5rs" - "reference" - "scribble" - "web-server-guide" - "web-server-reference")))) + (set! words (text:get-completions/manuals #f))) words))) ;; add-built-in-languages : -> void diff --git a/collects/drscheme/tools.scrbl b/collects/drscheme/tools.scrbl index eee0e18b8a..77d701f8e5 100644 --- a/collects/drscheme/tools.scrbl +++ b/collects/drscheme/tools.scrbl @@ -10,6 +10,8 @@ (define (item/cap x . ys) (apply item (bold (format "~a" x)) ": " ys)) ;; indexing missing +(define (gui x) (bold x)) + ] @title{PLT Plugins: DrScheme Extension Manual} @@ -18,9 +20,11 @@ This manual describes DrScheme's tools interface. It assumes familiarity with PLT Scheme, as described in -@(secref #:doc '(lib "scribblings/guide/guide.scrbl") "top"). -DrScheme, as described in {\DrSchemeManual}, and -the Framework, as described in {\FrameworkManual}. +@(secref #:doc '(lib "scribblings/guide/guide.scrbl") "top"), +DrScheme, as described in +@(secref #:doc '(lib "drscheme/drscheme.scrbl") "top"), +and the Framework, as described in +@(secref #:doc '(lib "framework/framework.scrbl") "top"). @section{Thanks} @@ -53,10 +57,6 @@ add new functions and other values bound in the users namespace. See the DrScheme manual for more information on constructing libraries. -Tools rely heavily on MzScheme's @scheme[units]. They also -require understanding of \Mzhyperref{libraries and -collections}{mz:mzlib}. - When DrScheme starts up, it looks for tools by reading fields in the @File{info.ss} file of each collection and the newest version of each PLaneT package installed on the @@ -102,14 +102,14 @@ This bitmap and the name show up in the about box, Help Desk's bug report form, and the splash screen as the tool is loaded at DrScheme's startup. -\index{drscheme:tool atsign \scmsig{drscheme:tool}} -\index{phase1}\index{phase2} +@index{phase1} +@index{phase2} Each of @scheme[tools] files must contain a module that @scheme[provide]s @scheme[tool@], which must be bound to a @scheme[unit]. The unit must import the @scheme[drscheme:tool^] signature, which is provided by the @FileFirst{tool.ss} library in the -@scheme[drscheme] collection. The \scmsig{drscheme:tool} +@scheme[drscheme] collection. The @scheme[drscheme:tool^] signature contains all of the names listed in this manual. The unit must export the @scheme[drscheme:tool-exports^] signature. @@ -135,14 +135,12 @@ extension. Then, other languages that are aware of the extension can supply non-default implementations of the additional functionality. -\tag{phase1}{phase~1} Phase 1 functions: @itemize{ @item{@scheme[drscheme:language:extend-language-interface]} @item{@scheme[drscheme:unit:add-to-program-editor-mixin]} } -\tag{phase2}{phase~2} Phase 2 functions: @itemize{ @item{@scheme[drscheme:language-configuration:add-language]} @@ -185,7 +183,7 @@ been loaded and that the @scheme[phase1] and @scheme[phase2] functions have been called. @section{Adding Languages to DrScheme} -\index{adding languages to DrScheme} +@index{adding languages to DrScheme} \label{tools:adding-languages} @subsection{Adding Module-based Languages to DrScheme} @@ -198,7 +196,7 @@ where the module is saved. Include these definitions: @(itemize @item/cap['drscheme-language-modules]{ - \index{drscheme-language-modules} This must be bound to a + @index{drscheme-language-modules} This must be bound to a list of collection path specifications or strings, one for each language in the collection. Each collection path specification is the quoted form of what might appear as @@ -209,7 +207,7 @@ definitions: like string arguments to @scheme[require]. } @item/cap['drscheme-language-positions]{ -\index{drscheme-language-positions} +@index{drscheme-language-positions} This must be bound to a list of language positions. Each language position corresponds to the position of the language in language @@ -217,7 +215,7 @@ This must be bound to a length must be at least two. } @item/cap['drscheme-language-numbers]{ -\index{drscheme-language-numbers} +@index{drscheme-language-numbers} This is optional. If present, it must be a list of a list of numbers. Each list corresponds to a single language from this collection. @@ -229,14 +227,14 @@ This is optional. If } @item/cap['drscheme-language-one-line-summaries]{ -\index{drscheme-language-one-line-summaries} +@index{drscheme-language-one-line-summaries} This is optional. If present, it must be a list of strings. Each string is displayed at the bottom of the language dialog when the corresponding language is selected. } @item/cap['drscheme-language-urls]{ -\index{drscheme-language-urls} +@index{drscheme-language-urls} This is optional. If present, it must be a list whose elements are either strings or @scheme{#f}. @@ -244,7 +242,7 @@ This is the interactions window opens a web browser to the url. } @item/cap['drscheme-language-readers]{ -\index{drscheme-language-readers} +@index{drscheme-language-readers} This is optional. If present, it must be bound to a quoted list of module specifications (that is, a quoted version of the argument @@ -419,14 +417,14 @@ classes derived from that class as its result. For example: extends the interactions text class with a method named @tt{method1}. @section[#:tag "Expanding and Breaking"]{Expanding the User's Program Text and Breaking} -\index{expanding user programs} -\index{breaking} -\index{break button} +@index{expanding user programs} +@index{breaking} +@index{break button} Macro-expanding a program may involve arbitrary computation and requires the setup of the correct language. To aid this, DrScheme's tool interface provides -\iscmprocedure{drscheme:eval:expand-program} to help. Use +@scheme[drscheme:eval:expand-program] to help. Use this method to extract the fully expanded program text in a particular language. @@ -453,19 +451,19 @@ method. This method controls what behavior the Break button has. @section{Editor Modes} -\index{modes} -\index{scheme mode} +@index{modes} +@index{scheme mode} DrScheme provides support for multiple editor modes. Tools register modes via -\iscmprocedure{drscheme:modes:add-mode}. Each mode is -visible in the \gui{Modes} submenu of the \gui{Edit} +@scheme[drscheme:modes:add-mode]. Each mode is +visible in the @gui{Modes} submenu of the @gui{Edit} menu. Initially, DrScheme only supports two modes: scheme mode and text mode. DrScheme automatically selects a mode for each open file based on the file's extension. If the file ends with -\File{.txt}, DrScheme uses text mode. Otherwise, DrScheme +@File{.txt}, DrScheme uses text mode. Otherwise, DrScheme uses Scheme mode. @section{Language-specific capabilities} @@ -474,12 +472,12 @@ Drscheme's capability interface provides a mechanism for tools to allow languages to hide their GUI interface, if the tool does not apply to the language. Tools register capabilities keyed with symbols via. -\iscmprocedure{drscheme:language:register-capability}. Once +@scheme[drscheme:language:register-capability]. Once registered, a tool can query a language, via the \iscmintfmethodspec{drscheme:language:language}{capability-value}{capability-value} method. The result from this method controls whether or not the tool shows this part of the GUI for DrScheme. -See \iscmprocedure{drscheme:language:register-capability} +See @scheme[drscheme:language:register-capability] for a list of the capabilities registered by default. diff --git a/collects/framework/framework.scrbl b/collects/framework/framework.scrbl new file mode 100644 index 0000000000..15763999c8 --- /dev/null +++ b/collects/framework/framework.scrbl @@ -0,0 +1,9 @@ +#lang scribble/doc + +@begin[ +(require scribble/manual) +] + +@title{PLT Framework: GUI Application Framework} + +Nothing yet. diff --git a/collects/framework/info.ss b/collects/framework/info.ss index d35ec4039a..430cdfdd9b 100644 --- a/collects/framework/info.ss +++ b/collects/framework/info.ss @@ -1,4 +1,5 @@ (module info setup/infotab (define name "Framework") - (define doc.txt "doc.txt")) + (define doc.txt "doc.txt") + (define scribblings '(("framework.scrbl" (#;multi-page main-doc))))) diff --git a/collects/framework/private/color.ss b/collects/framework/private/color.ss index 78d6889eed..ab1c4dc6e9 100644 --- a/collects/framework/private/color.ss +++ b/collects/framework/private/color.ss @@ -37,6 +37,7 @@ thaw-colorer reset-region + get-region update-region-end skip-whitespace diff --git a/collects/framework/private/scheme.ss b/collects/framework/private/scheme.ss index 15b5a506da..6e5f6f9f7c 100644 --- a/collects/framework/private/scheme.ss +++ b/collects/framework/private/scheme.ss @@ -431,7 +431,7 @@ (inherit get-styles-fixed) (inherit has-focus? find-snip split-snip - position-location get-dc) + position-location get-dc get-region) (define/override (get-word-at current-pos) (let ([no-word ""]) @@ -447,12 +447,18 @@ [else no-word]))]))) (define/private (look-for-non-symbol start) - (let loop ([i start]) - (cond - [(< i 0) 0] - [(eq? (classify-position i) 'symbol) - (loop (- i 1))] - [else (+ i 1)]))) + (let-values ([(region-start region-end) (get-region)]) + (let loop ([i start]) + (cond + [(and (number? region-start) + (< i region-start)) + region-start] + [(< i 0) + 0] + [(eq? (classify-position i) 'symbol) + (loop (- i 1))] + [else + (+ i 1)])))) (public tabify-on-return? tabify tabify-all insert-return calc-last-para